1use std::num::IntErrorKind;
2
3use rustc_ast::{self as ast};
4use rustc_errors::codes::*;
5use rustc_errors::{
6 Applicability, Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level,
7};
8use rustc_feature::AttributeTemplate;
9use rustc_hir::AttrPath;
10use rustc_macros::{Diagnostic, Subdiagnostic};
11use rustc_span::{Span, Symbol};
12use rustc_target::spec::TargetTuple;
13
14#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
InvalidPredicate 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 {
InvalidPredicate { span: __binding_0, predicate: __binding_1
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid predicate `{$predicate}`")));
diag.code(E0537);
;
diag.arg("predicate", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
15#[diag("invalid predicate `{$predicate}`", code = E0537)]
16pub(crate) struct InvalidPredicate {
17 #[primary_span]
18 pub span: Span,
19
20 pub predicate: String,
21}
22
23#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
DocAliasEmpty<'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 {
DocAliasEmpty { span: __binding_0, attr_str: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$attr_str} attribute cannot have empty value")));
;
diag.arg("attr_str", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
24#[diag("{$attr_str} attribute cannot have empty value")]
25pub(crate) struct DocAliasEmpty<'a> {
26 #[primary_span]
27 pub span: Span,
28 pub attr_str: &'a str,
29}
30
31#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
DocAliasBadChar<'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 {
DocAliasBadChar {
span: __binding_0, attr_str: __binding_1, char_: __binding_2
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$char_} character isn't allowed in {$attr_str}")));
;
diag.arg("attr_str", __binding_1);
diag.arg("char_", __binding_2);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
32#[diag("{$char_} character isn't allowed in {$attr_str}")]
33pub(crate) struct DocAliasBadChar<'a> {
34 #[primary_span]
35 pub span: Span,
36 pub attr_str: &'a str,
37 pub char_: char,
38}
39
40#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
DocAliasStartEnd<'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 {
DocAliasStartEnd { span: __binding_0, attr_str: __binding_1
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$attr_str} cannot start or end with ' '")));
;
diag.arg("attr_str", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
41#[diag("{$attr_str} cannot start or end with ' '")]
42pub(crate) struct DocAliasStartEnd<'a> {
43 #[primary_span]
44 pub span: Span,
45 pub attr_str: &'a str,
46}
47
48#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
CguFieldsMissing<'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 {
CguFieldsMissing {
span: __binding_0, name: __binding_1, field: __binding_2 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$name})]` is missing a `{$field}` argument")));
;
diag.arg("name", __binding_1);
diag.arg("field", __binding_2);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
49#[diag("`#[{$name})]` is missing a `{$field}` argument")]
50pub(crate) struct CguFieldsMissing<'a> {
51 #[primary_span]
52 pub span: Span,
53 pub name: &'a AttrPath,
54 pub field: Symbol,
55}
56
57#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
DocAttrNotCrateLevel 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 {
DocAttrNotCrateLevel {
span: __binding_0, attr_name: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#![doc({$attr_name} = \"...\")]` isn't allowed as a crate-level attribute")));
;
diag.arg("attr_name", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
58#[diag("`#![doc({$attr_name} = \"...\")]` isn't allowed as a crate-level attribute")]
59pub(crate) struct DocAttrNotCrateLevel {
60 #[primary_span]
61 pub span: Span,
62 pub attr_name: Symbol,
63}
64
65#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
DocKeywordNotKeyword 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 {
DocKeywordNotKeyword {
span: __binding_0, keyword: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("nonexistent keyword `{$keyword}` used in `#[doc(keyword = \"...\")]`")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only existing keywords are allowed in core/std")));
;
diag.arg("keyword", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
66#[diag("nonexistent keyword `{$keyword}` used in `#[doc(keyword = \"...\")]`")]
67#[help("only existing keywords are allowed in core/std")]
68pub(crate) struct DocKeywordNotKeyword {
69 #[primary_span]
70 pub span: Span,
71 pub keyword: Symbol,
72}
73
74#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
DocAttributeNotAttribute 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 {
DocAttributeNotAttribute {
span: __binding_0, attribute: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("nonexistent builtin attribute `{$attribute}` used in `#[doc(attribute = \"...\")]`")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only existing builtin attributes are allowed in core/std")));
;
diag.arg("attribute", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
75#[diag("nonexistent builtin attribute `{$attribute}` used in `#[doc(attribute = \"...\")]`")]
76#[help("only existing builtin attributes are allowed in core/std")]
77pub(crate) struct DocAttributeNotAttribute {
78 #[primary_span]
79 pub span: Span,
80 pub attribute: Symbol,
81}
82
83#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for MissingSince
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 {
MissingSince { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing 'since'")));
diag.code(E0542);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
84#[diag("missing 'since'", code = E0542)]
85pub(crate) struct MissingSince {
86 #[primary_span]
87 pub span: Span,
88}
89
90#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for MissingNote
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 {
MissingNote { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing 'note'")));
diag.code(E0543);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
91#[diag("missing 'note'", code = E0543)]
92pub(crate) struct MissingNote {
93 #[primary_span]
94 pub span: Span,
95}
96
97#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
MultipleStabilityLevels 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 {
MultipleStabilityLevels { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple stability levels")));
diag.code(E0544);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
98#[diag("multiple stability levels", code = E0544)]
99pub(crate) struct MultipleStabilityLevels {
100 #[primary_span]
101 pub span: Span,
102}
103
104#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
InvalidIssueString 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 {
InvalidIssueString { span: __binding_0, cause: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`issue` must be a non-zero numeric string or \"none\"")));
diag.code(E0545);
;
diag.span(__binding_0);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
105#[diag("`issue` must be a non-zero numeric string or \"none\"", code = E0545)]
106pub(crate) struct InvalidIssueString {
107 #[primary_span]
108 pub span: Span,
109
110 #[subdiagnostic]
111 pub cause: Option<InvalidIssueStringCause>,
112}
113
114#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for InvalidIssueStringCause {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
InvalidIssueStringCause::MustNotBeZero { span: __binding_0 }
=> {
diag.store_args();
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`issue` must not be \"0\", use \"none\" instead")));
diag.span_label(__binding_0, __message);
diag.restore_args();
}
InvalidIssueStringCause::Empty { span: __binding_0 } => {
diag.store_args();
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot parse integer from empty string")));
diag.span_label(__binding_0, __message);
diag.restore_args();
}
InvalidIssueStringCause::InvalidDigit { span: __binding_0 }
=> {
diag.store_args();
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid digit found in string")));
diag.span_label(__binding_0, __message);
diag.restore_args();
}
InvalidIssueStringCause::PosOverflow { span: __binding_0 }
=> {
diag.store_args();
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("number too large to fit in target type")));
diag.span_label(__binding_0, __message);
diag.restore_args();
}
InvalidIssueStringCause::NegOverflow { span: __binding_0 }
=> {
diag.store_args();
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("number too small to fit in target type")));
diag.span_label(__binding_0, __message);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
117pub(crate) enum InvalidIssueStringCause {
118 #[label("`issue` must not be \"0\", use \"none\" instead")]
119 MustNotBeZero {
120 #[primary_span]
121 span: Span,
122 },
123
124 #[label("cannot parse integer from empty string")]
125 Empty {
126 #[primary_span]
127 span: Span,
128 },
129
130 #[label("invalid digit found in string")]
131 InvalidDigit {
132 #[primary_span]
133 span: Span,
134 },
135
136 #[label("number too large to fit in target type")]
137 PosOverflow {
138 #[primary_span]
139 span: Span,
140 },
141
142 #[label("number too small to fit in target type")]
143 NegOverflow {
144 #[primary_span]
145 span: Span,
146 },
147}
148
149impl InvalidIssueStringCause {
150 pub(crate) fn from_int_error_kind(span: Span, kind: &IntErrorKind) -> Option<Self> {
151 match kind {
152 IntErrorKind::Empty => Some(Self::Empty { span }),
153 IntErrorKind::InvalidDigit => Some(Self::InvalidDigit { span }),
154 IntErrorKind::PosOverflow => Some(Self::PosOverflow { span }),
155 IntErrorKind::NegOverflow => Some(Self::NegOverflow { span }),
156 IntErrorKind::Zero => Some(Self::MustNotBeZero { span }),
157 _ => None,
158 }
159 }
160}
161
162#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for MissingFeature
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 {
MissingFeature { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing 'feature'")));
diag.code(E0546);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
163#[diag("missing 'feature'", code = E0546)]
164pub(crate) struct MissingFeature {
165 #[primary_span]
166 pub span: Span,
167}
168
169#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
NonIdentFeature 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 {
NonIdentFeature { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("'feature' is not an identifier")));
diag.code(E0546);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
170#[diag("'feature' is not an identifier", code = E0546)]
171pub(crate) struct NonIdentFeature {
172 #[primary_span]
173 pub span: Span,
174}
175
176#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for MissingIssue
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 {
MissingIssue { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing 'issue'")));
diag.code(E0547);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
177#[diag("missing 'issue'", code = E0547)]
178pub(crate) struct MissingIssue {
179 #[primary_span]
180 pub span: Span,
181}
182
183#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
IncorrectReprFormatPackedOneOrZeroArg 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 {
IncorrectReprFormatPackedOneOrZeroArg { span: __binding_0 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("incorrect `repr(packed)` attribute format: `packed` takes exactly one parenthesized argument, or no parentheses at all")));
diag.code(E0552);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
186#[diag("incorrect `repr(packed)` attribute format: `packed` takes exactly one parenthesized argument, or no parentheses at all", code = E0552)]
187pub(crate) struct IncorrectReprFormatPackedOneOrZeroArg {
188 #[primary_span]
189 pub span: Span,
190}
191#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
IncorrectReprFormatPackedExpectInteger 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 {
IncorrectReprFormatPackedExpectInteger { span: __binding_0 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("incorrect `repr(packed)` attribute format: `packed` expects a literal integer as argument")));
diag.code(E0552);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
192#[diag("incorrect `repr(packed)` attribute format: `packed` expects a literal integer as argument", code = E0552)]
193pub(crate) struct IncorrectReprFormatPackedExpectInteger {
194 #[primary_span]
195 pub span: Span,
196}
197
198#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
InvalidReprHintNoParen 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 {
InvalidReprHintNoParen {
span: __binding_0, name: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid representation hint: `{$name}` does not take a parenthesized argument list")));
diag.code(E0552);
;
diag.arg("name", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
199#[diag("invalid representation hint: `{$name}` does not take a parenthesized argument list", code = E0552)]
200pub(crate) struct InvalidReprHintNoParen {
201 #[primary_span]
202 pub span: Span,
203
204 pub name: Symbol,
205}
206
207#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
InvalidReprHintNoValue 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 {
InvalidReprHintNoValue {
span: __binding_0, name: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid representation hint: `{$name}` does not take a value")));
diag.code(E0552);
;
diag.arg("name", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
208#[diag("invalid representation hint: `{$name}` does not take a value", code = E0552)]
209pub(crate) struct InvalidReprHintNoValue {
210 #[primary_span]
211 pub span: Span,
212
213 pub name: Symbol,
214}
215
216#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
InvalidReprAlignNeedArg 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 {
InvalidReprAlignNeedArg { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid `repr(align)` attribute: `align` needs an argument")));
let __code_0 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("align(...)"))
})].into_iter();
diag.code(E0589);
;
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("supply an argument here")),
__code_0, rustc_errors::Applicability::HasPlaceholders,
rustc_errors::SuggestionStyle::ShowCode);
diag
}
}
}
}
};Diagnostic)]
217#[diag("invalid `repr(align)` attribute: `align` needs an argument", code = E0589)]
218pub(crate) struct InvalidReprAlignNeedArg {
219 #[primary_span]
220 #[suggestion(
221 "supply an argument here",
222 code = "align(...)",
223 applicability = "has-placeholders"
224 )]
225 pub span: Span,
226}
227
228#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
InvalidReprGeneric<'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 {
InvalidReprGeneric {
span: __binding_0,
repr_arg: __binding_1,
error_part: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid `repr({$repr_arg})` attribute: {$error_part}")));
diag.code(E0589);
;
diag.arg("repr_arg", __binding_1);
diag.arg("error_part", __binding_2);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
229#[diag("invalid `repr({$repr_arg})` attribute: {$error_part}", code = E0589)]
230pub(crate) struct InvalidReprGeneric<'a> {
231 #[primary_span]
232 pub span: Span,
233
234 pub repr_arg: String,
235 pub error_part: &'a str,
236}
237
238#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
IncorrectReprFormatAlignOneArg 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 {
IncorrectReprFormatAlignOneArg { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("incorrect `repr(align)` attribute format: `align` takes exactly one argument in parentheses")));
diag.code(E0693);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
239#[diag("incorrect `repr(align)` attribute format: `align` takes exactly one argument in parentheses", code = E0693)]
240pub(crate) struct IncorrectReprFormatAlignOneArg {
241 #[primary_span]
242 pub span: Span,
243}
244
245#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
IncorrectReprFormatExpectInteger 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 {
IncorrectReprFormatExpectInteger { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("incorrect `repr(align)` attribute format: `align` expects a literal integer as argument")));
diag.code(E0693);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
246#[diag("incorrect `repr(align)` attribute format: `align` expects a literal integer as argument", code = E0693)]
247pub(crate) struct IncorrectReprFormatExpectInteger {
248 #[primary_span]
249 pub span: Span,
250}
251
252#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
IncorrectReprFormatGeneric 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 {
IncorrectReprFormatGeneric {
span: __binding_0, repr_arg: __binding_1, cause: __binding_2
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("incorrect `repr({$repr_arg})` attribute format")));
diag.code(E0693);
;
diag.arg("repr_arg", __binding_1);
diag.span(__binding_0);
if let Some(__binding_2) = __binding_2 {
diag.subdiagnostic(__binding_2);
}
diag
}
}
}
}
};Diagnostic)]
253#[diag("incorrect `repr({$repr_arg})` attribute format", code = E0693)]
254pub(crate) struct IncorrectReprFormatGeneric {
255 #[primary_span]
256 pub span: Span,
257
258 pub repr_arg: Symbol,
259
260 #[subdiagnostic]
261 pub cause: Option<IncorrectReprFormatGenericCause>,
262}
263
264#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for IncorrectReprFormatGenericCause {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
IncorrectReprFormatGenericCause::Int {
span: __binding_0, name: __binding_1, value: __binding_2 }
=> {
let __code_1 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}({1})", __binding_1,
__binding_2))
})].into_iter();
diag.store_args();
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use parentheses instead")));
diag.span_suggestions_with_style(__binding_0, __message,
__code_1, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
diag.restore_args();
}
IncorrectReprFormatGenericCause::Symbol {
span: __binding_0, name: __binding_1, value: __binding_2 }
=> {
let __code_2 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}({1})", __binding_1,
__binding_2))
})].into_iter();
diag.store_args();
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use parentheses instead")));
diag.span_suggestions_with_style(__binding_0, __message,
__code_2, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
265pub(crate) enum IncorrectReprFormatGenericCause {
266 #[suggestion(
267 "use parentheses instead",
268 code = "{name}({value})",
269 applicability = "machine-applicable"
270 )]
271 Int {
272 #[primary_span]
273 span: Span,
274
275 #[skip_arg]
276 name: Symbol,
277
278 #[skip_arg]
279 value: u128,
280 },
281
282 #[suggestion(
283 "use parentheses instead",
284 code = "{name}({value})",
285 applicability = "machine-applicable"
286 )]
287 Symbol {
288 #[primary_span]
289 span: Span,
290
291 #[skip_arg]
292 name: Symbol,
293
294 #[skip_arg]
295 value: Symbol,
296 },
297}
298
299impl IncorrectReprFormatGenericCause {
300 pub(crate) fn from_lit_kind(span: Span, kind: &ast::LitKind, name: Symbol) -> Option<Self> {
301 match *kind {
302 ast::LitKind::Int(value, ast::LitIntType::Unsuffixed) => {
303 Some(Self::Int { span, name, value: value.get() })
304 }
305 ast::LitKind::Str(value, _) => Some(Self::Symbol { span, name, value }),
306 _ => None,
307 }
308 }
309}
310
311#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
RustcPromotablePairing 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 {
RustcPromotablePairing { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`rustc_promotable` attribute must be paired with either a `rustc_const_unstable` or a `rustc_const_stable` attribute")));
diag.code(E0717);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
312#[diag("`rustc_promotable` attribute must be paired with either a `rustc_const_unstable` or a `rustc_const_stable` attribute", code = E0717)]
313pub(crate) struct RustcPromotablePairing {
314 #[primary_span]
315 pub span: Span,
316}
317
318#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
RustcAllowedUnstablePairing 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 {
RustcAllowedUnstablePairing { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`rustc_allowed_through_unstable_modules` attribute must be paired with a `stable` attribute")));
diag.code(E0789);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
319#[diag("`rustc_allowed_through_unstable_modules` attribute must be paired with a `stable` attribute", code = E0789)]
320pub(crate) struct RustcAllowedUnstablePairing {
321 #[primary_span]
322 pub span: Span,
323}
324
325#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
DeprecatedItemSuggestion 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 {
DeprecatedItemSuggestion {
span: __binding_0,
is_nightly: __binding_1,
details: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("suggestions on deprecated items are unstable")));
;
diag.span(__binding_0);
if __binding_1 {
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add `#![feature(deprecated_suggestion)]` to the crate root")));
}
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("see #94785 for more details")));
diag
}
}
}
}
};Diagnostic)]
326#[diag("suggestions on deprecated items are unstable")]
327pub(crate) struct DeprecatedItemSuggestion {
328 #[primary_span]
329 pub span: Span,
330
331 #[help("add `#![feature(deprecated_suggestion)]` to the crate root")]
332 pub is_nightly: bool,
333
334 #[note("see #94785 for more details")]
335 pub details: (),
336}
337
338#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ExpectedSingleVersionLiteral 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 {
ExpectedSingleVersionLiteral { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected single version literal")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
339#[diag("expected single version literal")]
340pub(crate) struct ExpectedSingleVersionLiteral {
341 #[primary_span]
342 pub span: Span,
343}
344
345#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ExpectedVersionLiteral 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 {
ExpectedVersionLiteral { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected a version literal")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
346#[diag("expected a version literal")]
347pub(crate) struct ExpectedVersionLiteral {
348 #[primary_span]
349 pub span: Span,
350}
351
352#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ExpectsFeatureList 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 {
ExpectsFeatureList { span: __binding_0, name: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$name}` expects a list of feature names")));
;
diag.arg("name", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
353#[diag("`{$name}` expects a list of feature names")]
354pub(crate) struct ExpectsFeatureList {
355 #[primary_span]
356 pub span: Span,
357
358 pub name: String,
359}
360
361#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ExpectsFeatures 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 {
ExpectsFeatures { span: __binding_0, name: __binding_1 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$name}` expects feature names")));
;
diag.arg("name", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
362#[diag("`{$name}` expects feature names")]
363pub(crate) struct ExpectsFeatures {
364 #[primary_span]
365 pub span: Span,
366
367 pub name: String,
368}
369
370#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for InvalidSince
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 {
InvalidSince { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("'since' must be a Rust version number, such as \"1.31.0\"")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
371#[diag("'since' must be a Rust version number, such as \"1.31.0\"")]
372pub(crate) struct InvalidSince {
373 #[primary_span]
374 pub span: Span,
375}
376
377#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for SoftNoArgs
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 {
SoftNoArgs { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`soft` should not have any arguments")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
378#[diag("`soft` should not have any arguments")]
379pub(crate) struct SoftNoArgs {
380 #[primary_span]
381 pub span: Span,
382}
383
384#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
UnknownVersionLiteral 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 {
UnknownVersionLiteral { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown version literal format, assuming it refers to a future version")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
385#[diag("unknown version literal format, assuming it refers to a future version")]
386pub(crate) struct UnknownVersionLiteral {
387 #[primary_span]
388 pub span: Span,
389}
390
391#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for UnusedMultiple
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 {
UnusedMultiple {
this: __binding_0, other: __binding_1, name: __binding_2 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple `{$name}` attributes")));
let __code_3 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
;
diag.arg("name", __binding_2);
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove this attribute")),
__code_3, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
diag.span_note(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute also specified here")));
diag
}
}
}
}
};Diagnostic)]
393#[diag("multiple `{$name}` attributes")]
394pub(crate) struct UnusedMultiple {
395 #[primary_span]
396 #[suggestion("remove this attribute", code = "", applicability = "machine-applicable")]
397 pub this: Span,
398 #[note("attribute also specified here")]
399 pub other: Span,
400 pub name: Symbol,
401}
402
403#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for NullOnExport
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 {
NullOnExport { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`export_name` may not contain null characters")));
diag.code(E0648);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
404#[diag("`export_name` may not contain null characters", code = E0648)]
405pub(crate) struct NullOnExport {
406 #[primary_span]
407 pub span: Span,
408}
409
410#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
NullOnLinkSection 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 {
NullOnLinkSection { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`link_section` may not contain null characters")));
diag.code(E0648);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
411#[diag("`link_section` may not contain null characters", code = E0648)]
412pub(crate) struct NullOnLinkSection {
413 #[primary_span]
414 pub span: Span,
415}
416
417#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
NullOnObjcClass 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 {
NullOnObjcClass { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`objc::class!` may not contain null characters")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
418#[diag("`objc::class!` may not contain null characters")]
419pub(crate) struct NullOnObjcClass {
420 #[primary_span]
421 pub span: Span,
422}
423
424#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
NullOnObjcSelector 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 {
NullOnObjcSelector { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`objc::selector!` may not contain null characters")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
425#[diag("`objc::selector!` may not contain null characters")]
426pub(crate) struct NullOnObjcSelector {
427 #[primary_span]
428 pub span: Span,
429}
430
431#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ObjcClassExpectedStringLiteral 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 {
ObjcClassExpectedStringLiteral { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`objc::class!` expected a string literal")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
432#[diag("`objc::class!` expected a string literal")]
433pub(crate) struct ObjcClassExpectedStringLiteral {
434 #[primary_span]
435 pub span: Span,
436}
437
438#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ObjcSelectorExpectedStringLiteral 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 {
ObjcSelectorExpectedStringLiteral { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`objc::selector!` expected a string literal")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
439#[diag("`objc::selector!` expected a string literal")]
440pub(crate) struct ObjcSelectorExpectedStringLiteral {
441 #[primary_span]
442 pub span: Span,
443}
444
445#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
StabilityOutsideStd 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 {
StabilityOutsideStd { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("stability attributes may not be used outside of the standard library")));
diag.code(E0734);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
446#[diag("stability attributes may not be used outside of the standard library", code = E0734)]
447pub(crate) struct StabilityOutsideStd {
448 #[primary_span]
449 pub span: Span,
450}
451
452#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
EmptyConfusables 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 {
EmptyConfusables { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected at least one confusable name")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
453#[diag("expected at least one confusable name")]
454pub(crate) struct EmptyConfusables {
455 #[primary_span]
456 pub span: Span,
457}
458
459#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for InvalidTarget
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 {
InvalidTarget {
span: __binding_0,
name: __binding_1,
target: __binding_2,
applied: __binding_3,
only: __binding_4 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$name}]` attribute cannot be used on {$target}")));
let __code_4 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[{$name}]` can {$only}be applied to {$applied}")));
;
diag.arg("name", __binding_1);
diag.arg("target", __binding_2);
diag.arg("applied", __binding_3);
diag.arg("only", __binding_4);
diag.span(__binding_0);
diag.span_suggestions_with_style(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("remove the attribute")),
__code_4, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::CompletelyHidden);
diag
}
}
}
}
};Diagnostic)]
460#[help("`#[{$name}]` can {$only}be applied to {$applied}")]
461#[diag("`#[{$name}]` attribute cannot be used on {$target}")]
462pub(crate) struct InvalidTarget {
463 #[primary_span]
464 #[suggestion(
465 "remove the attribute",
466 code = "",
467 applicability = "machine-applicable",
468 style = "tool-only"
469 )]
470 pub span: Span,
471 pub name: AttrPath,
472 pub target: &'static str,
473 pub applied: DiagArgValue,
474 pub only: &'static str,
475}
476
477#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
InvalidAlignmentValue 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 {
InvalidAlignmentValue {
span: __binding_0, error_part: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid alignment value: {$error_part}")));
diag.code(E0589);
;
diag.arg("error_part", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
478#[diag("invalid alignment value: {$error_part}", code = E0589)]
479pub(crate) struct InvalidAlignmentValue {
480 #[primary_span]
481 pub span: Span,
482 pub error_part: &'static str,
483}
484
485#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for ReprIdent
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 {
ReprIdent { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("meta item in `repr` must be an identifier")));
diag.code(E0565);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
486#[diag("meta item in `repr` must be an identifier", code = E0565)]
487pub(crate) struct ReprIdent {
488 #[primary_span]
489 pub span: Span,
490}
491
492#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
UnrecognizedReprHint 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 {
UnrecognizedReprHint { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unrecognized representation hint")));
diag.code(E0552);
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information, visit <https://doc.rust-lang.org/reference/type-layout.html?highlight=repr#representations>")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
493#[diag("unrecognized representation hint", code = E0552)]
494#[help(
495 "valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`"
496)]
497#[note(
498 "for more information, visit <https://doc.rust-lang.org/reference/type-layout.html?highlight=repr#representations>"
499)]
500pub(crate) struct UnrecognizedReprHint {
501 #[primary_span]
502 pub span: Span,
503}
504
505#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
UnstableFeatureBoundIncompatibleStability 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 {
UnstableFeatureBoundIncompatibleStability {
span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("item annotated with `#[unstable_feature_bound]` should not be stable")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("if this item is meant to be stable, do not use any functions annotated with `#[unstable_feature_bound]`. Otherwise, mark this item as unstable with `#[unstable]`")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
506#[diag("item annotated with `#[unstable_feature_bound]` should not be stable")]
507#[help(
508 "if this item is meant to be stable, do not use any functions annotated with `#[unstable_feature_bound]`. Otherwise, mark this item as unstable with `#[unstable]`"
509)]
510pub(crate) struct UnstableFeatureBoundIncompatibleStability {
511 #[primary_span]
512 pub span: Span,
513}
514
515#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
NakedFunctionIncompatibleAttribute 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 {
NakedFunctionIncompatibleAttribute {
span: __binding_0,
naked_span: __binding_1,
attr: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute incompatible with `#[unsafe(naked)]`")));
diag.code(E0736);
;
diag.arg("attr", __binding_2);
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `{$attr}` attribute is incompatible with `#[unsafe(naked)]`")));
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("function marked with `#[unsafe(naked)]` here")));
diag
}
}
}
}
};Diagnostic)]
516#[diag("attribute incompatible with `#[unsafe(naked)]`", code = E0736)]
517pub(crate) struct NakedFunctionIncompatibleAttribute {
518 #[primary_span]
519 #[label("the `{$attr}` attribute is incompatible with `#[unsafe(naked)]`")]
520 pub span: Span,
521 #[label("function marked with `#[unsafe(naked)]` here")]
522 pub naked_span: Span,
523 pub attr: String,
524}
525
526#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
LinkOrdinalOutOfRange 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 {
LinkOrdinalOutOfRange {
span: __binding_0, ordinal: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("ordinal value in `link_ordinal` is too large: `{$ordinal}`")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the value may not exceed `u16::MAX`")));
;
diag.arg("ordinal", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
527#[diag("ordinal value in `link_ordinal` is too large: `{$ordinal}`")]
528#[note("the value may not exceed `u16::MAX`")]
529pub(crate) struct LinkOrdinalOutOfRange {
530 #[primary_span]
531 pub span: Span,
532 pub ordinal: u128,
533}
534
535#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
RustcScalableVectorCountOutOfRange 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 {
RustcScalableVectorCountOutOfRange {
span: __binding_0, n: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("element count in `rustc_scalable_vector` is too large: `{$n}`")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the value may not exceed `u16::MAX`")));
;
diag.arg("n", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
536#[diag("element count in `rustc_scalable_vector` is too large: `{$n}`")]
537#[note("the value may not exceed `u16::MAX`")]
538pub(crate) struct RustcScalableVectorCountOutOfRange {
539 #[primary_span]
540 pub span: Span,
541 pub n: u128,
542}
543
544#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
AttributeRequiresOpt 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 {
AttributeRequiresOpt { span: __binding_0, opt: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("attribute requires {$opt} to be enabled")));
;
diag.arg("opt", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
545#[diag("attribute requires {$opt} to be enabled")]
546pub(crate) struct AttributeRequiresOpt {
547 #[primary_span]
548 pub span: Span,
549 pub opt: &'static str,
550}
551
552pub(crate) enum AttributeParseErrorReason<'a> {
553 ExpectedNoArgs,
554 ExpectedStringLiteral {
555 byte_string: Option<Span>,
556 },
557 ExpectedFilenameLiteral,
558 ExpectedIntegerLiteral,
559 ExpectedIntegerLiteralInRange {
560 lower_bound: isize,
561 upper_bound: isize,
562 },
563 ExpectedAtLeastOneArgument,
564 ExpectedSingleArgument,
565 ExpectedList,
566 ExpectedListOrNoArgs,
567 ExpectedListWithNumArgsOrMore {
568 args: usize,
569 },
570 ExpectedNameValueOrNoArgs,
571 ExpectedNonEmptyStringLiteral,
572 UnexpectedLiteral,
573 ExpectedNameValue(Option<Symbol>),
574 DuplicateKey(Symbol),
575 ExpectedSpecificArgument {
576 possibilities: &'a [Symbol],
577 strings: bool,
578 list: bool,
580 },
581 ExpectedIdentifier,
582}
583
584#[derive(#[automatically_derived]
impl ::core::marker::Copy for ParsedDescription { }Copy, #[automatically_derived]
impl ::core::clone::Clone for ParsedDescription {
#[inline]
fn clone(&self) -> ParsedDescription { *self }
}Clone)]
586pub enum ParsedDescription {
587 Attribute,
589 Macro,
591}
592
593pub(crate) struct AttributeParseError<'a> {
594 pub(crate) span: Span,
595 pub(crate) attr_span: Span,
596 pub(crate) template: AttributeTemplate,
597 pub(crate) path: AttrPath,
598 pub(crate) description: ParsedDescription,
599 pub(crate) reason: AttributeParseErrorReason<'a>,
600 pub(crate) suggestions: Vec<String>,
601}
602
603impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AttributeParseError<'_> {
604 fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> {
605 let name = self.path.to_string();
606
607 let description = match self.description {
608 ParsedDescription::Attribute => "attribute",
609 ParsedDescription::Macro => "macro",
610 };
611
612 let mut diag = Diag::new(dcx, level, ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("malformed `{0}` {1} input", name,
description))
})format!("malformed `{name}` {description} input"));
613 diag.span(self.attr_span);
614 diag.code(E0539);
615 match self.reason {
616 AttributeParseErrorReason::ExpectedStringLiteral { byte_string } => {
617 if let Some(start_point_span) = byte_string {
618 diag.span_suggestion(
619 start_point_span,
620 "consider removing the prefix",
621 "",
622 Applicability::MaybeIncorrect,
623 );
624 diag.note("expected a normal string literal, not a byte string literal");
625
626 return diag;
627 } else {
628 diag.span_label(self.span, "expected a string literal here");
629 }
630 }
631 AttributeParseErrorReason::ExpectedFilenameLiteral => {
632 diag.span_label(self.span, "expected a filename string literal here");
633 }
634 AttributeParseErrorReason::ExpectedIntegerLiteral => {
635 diag.span_label(self.span, "expected an integer literal here");
636 }
637 AttributeParseErrorReason::ExpectedIntegerLiteralInRange {
638 lower_bound,
639 upper_bound,
640 } => {
641 diag.span_label(
642 self.span,
643 ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("expected an integer literal in the range of {0}..={1}",
lower_bound, upper_bound))
})format!(
644 "expected an integer literal in the range of {lower_bound}..={upper_bound}"
645 ),
646 );
647 }
648 AttributeParseErrorReason::ExpectedSingleArgument => {
649 diag.span_label(self.span, "expected a single argument here");
650 diag.code(E0805);
651 }
652 AttributeParseErrorReason::ExpectedAtLeastOneArgument => {
653 diag.span_label(self.span, "expected at least 1 argument here");
654 }
655 AttributeParseErrorReason::ExpectedList => {
656 diag.span_label(self.span, "expected this to be a list");
657 }
658 AttributeParseErrorReason::ExpectedListOrNoArgs => {
659 diag.span_label(self.span, "expected a list or no arguments here");
660 }
661 AttributeParseErrorReason::ExpectedListWithNumArgsOrMore { args } => {
662 diag.span_label(self.span, ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("expected {0} or more items", args))
})format!("expected {args} or more items"));
663 }
664 AttributeParseErrorReason::ExpectedNameValueOrNoArgs => {
665 diag.span_label(self.span, "didn't expect a list here");
666 }
667 AttributeParseErrorReason::ExpectedNonEmptyStringLiteral => {
668 diag.span_label(self.span, "string is not allowed to be empty");
669 }
670 AttributeParseErrorReason::DuplicateKey(key) => {
671 diag.span_label(self.span, ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("found `{0}` used as a key more than once",
key))
})format!("found `{key}` used as a key more than once"));
672 diag.code(E0538);
673 }
674 AttributeParseErrorReason::UnexpectedLiteral => {
675 diag.span_label(self.span, "didn't expect a literal here");
676 diag.code(E0565);
677 }
678 AttributeParseErrorReason::ExpectedNoArgs => {
679 diag.span_label(self.span, "didn't expect any arguments here");
680 diag.code(E0565);
681 }
682 AttributeParseErrorReason::ExpectedNameValue(None) => {
683 if self.span != self.attr_span {
685 diag.span_label(
686 self.span,
687 ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("expected this to be of the form `... = \"...\"`"))
})format!("expected this to be of the form `... = \"...\"`"),
688 );
689 }
690 }
691 AttributeParseErrorReason::ExpectedNameValue(Some(name)) => {
692 diag.span_label(
693 self.span,
694 ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("expected this to be of the form `{0} = \"...\"`",
name))
})format!("expected this to be of the form `{name} = \"...\"`"),
695 );
696 }
697 AttributeParseErrorReason::ExpectedSpecificArgument {
698 possibilities,
699 strings,
700 list: false,
701 } => {
702 let quote = if strings { '"' } else { '`' };
703 match possibilities {
704 &[] => {}
705 &[x] => {
706 diag.span_label(
707 self.span,
708 ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("the only valid argument here is {0}{1}{0}",
quote, x))
})format!("the only valid argument here is {quote}{x}{quote}"),
709 );
710 }
711 [first, second] => {
712 diag.span_label(self.span, ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("valid arguments are {0}{1}{0} or {0}{2}{0}",
quote, first, second))
})format!("valid arguments are {quote}{first}{quote} or {quote}{second}{quote}"));
713 }
714 [first @ .., second_to_last, last] => {
715 let mut res = String::new();
716 for i in first {
717 res.push_str(&::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}{1}{0}, ", quote, i))
})format!("{quote}{i}{quote}, "));
718 }
719 res.push_str(&::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}{1}{0} or {0}{2}{0}", quote,
second_to_last, last))
})format!(
720 "{quote}{second_to_last}{quote} or {quote}{last}{quote}"
721 ));
722
723 diag.span_label(self.span, ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("valid arguments are {0}", res))
})format!("valid arguments are {res}"));
724 }
725 }
726 }
727 AttributeParseErrorReason::ExpectedSpecificArgument {
728 possibilities,
729 strings,
730 list: true,
731 } => {
732 let quote = if strings { '"' } else { '`' };
733 match possibilities {
734 &[] => {}
735 &[x] => {
736 diag.span_label(
737 self.span,
738 ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("this {0} is only valid with {1}{2}{1} as an argument",
description, quote, x))
})format!(
739 "this {description} is only valid with {quote}{x}{quote} as an argument"
740 ),
741 );
742 }
743 [first, second] => {
744 diag.span_label(self.span, ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("this {0} is only valid with either {1}{2}{1} or {1}{3}{1} as an argument",
description, quote, first, second))
})format!("this {description} is only valid with either {quote}{first}{quote} or {quote}{second}{quote} as an argument"));
745 }
746 [first @ .., second_to_last, last] => {
747 let mut res = String::new();
748 for i in first {
749 res.push_str(&::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}{1}{0}, ", quote, i))
})format!("{quote}{i}{quote}, "));
750 }
751 res.push_str(&::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}{1}{0} or {0}{2}{0}", quote,
second_to_last, last))
})format!(
752 "{quote}{second_to_last}{quote} or {quote}{last}{quote}"
753 ));
754
755 diag.span_label(self.span, ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("this {0} is only valid with one of the following arguments: {1}",
description, res))
})format!("this {description} is only valid with one of the following arguments: {res}"));
756 }
757 }
758 }
759 AttributeParseErrorReason::ExpectedIdentifier => {
760 diag.span_label(self.span, "expected a valid identifier here");
761 }
762 }
763
764 if let Some(link) = self.template.docs {
765 diag.note(::alloc::__export::must_use({
::alloc::fmt::format(format_args!("for more information, visit <{0}>",
link))
})format!("for more information, visit <{link}>"));
766 }
767
768 if self.suggestions.len() < 4 {
769 diag.span_suggestions(
770 self.attr_span,
771 if self.suggestions.len() == 1 {
772 "must be of the form".to_string()
773 } else {
774 ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("try changing it to one of the following valid forms of the {0}",
description))
})format!(
775 "try changing it to one of the following valid forms of the {description}"
776 )
777 },
778 self.suggestions,
779 Applicability::HasPlaceholders,
780 );
781 }
782
783 diag
784 }
785}
786
787#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
InvalidAttrUnsafe 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 {
InvalidAttrUnsafe { span: __binding_0, name: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$name}` is not an unsafe attribute")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("extraneous unsafe is not allowed in attributes")));
;
diag.arg("name", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this is not an unsafe attribute")));
diag
}
}
}
}
};Diagnostic)]
788#[diag("`{$name}` is not an unsafe attribute")]
789#[note("extraneous unsafe is not allowed in attributes")]
790pub(crate) struct InvalidAttrUnsafe {
791 #[primary_span]
792 #[label("this is not an unsafe attribute")]
793 pub span: Span,
794 pub name: AttrPath,
795}
796
797#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
UnsafeAttrOutsideUnsafe 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 {
UnsafeAttrOutsideUnsafe {
span: __binding_0, suggestion: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsafe attribute used without unsafe")));
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("usage of unsafe attribute")));
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
798#[diag("unsafe attribute used without unsafe")]
799pub(crate) struct UnsafeAttrOutsideUnsafe {
800 #[primary_span]
801 #[label("usage of unsafe attribute")]
802 pub span: Span,
803 #[subdiagnostic]
804 pub suggestion: Option<UnsafeAttrOutsideUnsafeSuggestion>,
805}
806
807#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for UnsafeAttrOutsideUnsafeSuggestion
{
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
UnsafeAttrOutsideUnsafeSuggestion {
left: __binding_0, right: __binding_1 } => {
let mut suggestions = Vec::new();
let __code_5 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!("unsafe("))
});
let __code_6 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!(")"))
});
suggestions.push((__binding_0, __code_5));
suggestions.push((__binding_1, __code_6));
diag.store_args();
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("wrap the attribute in `unsafe(...)`")));
diag.multipart_suggestion_with_style(__message, suggestions,
rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
808#[multipart_suggestion("wrap the attribute in `unsafe(...)`", applicability = "machine-applicable")]
809pub(crate) struct UnsafeAttrOutsideUnsafeSuggestion {
810 #[suggestion_part(code = "unsafe(")]
811 pub left: Span,
812 #[suggestion_part(code = ")")]
813 pub right: Span,
814}
815
816#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for MetaBadDelim
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 {
MetaBadDelim { span: __binding_0, sugg: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("wrong meta list delimiters")));
;
diag.span(__binding_0);
diag.subdiagnostic(__binding_1);
diag
}
}
}
}
};Diagnostic)]
817#[diag("wrong meta list delimiters")]
818pub(crate) struct MetaBadDelim {
819 #[primary_span]
820 pub span: Span,
821 #[subdiagnostic]
822 pub sugg: MetaBadDelimSugg,
823}
824
825#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for MetaBadDelimSugg {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
MetaBadDelimSugg { open: __binding_0, close: __binding_1 }
=> {
let mut suggestions = Vec::new();
let __code_7 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!("("))
});
let __code_8 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!(")"))
});
suggestions.push((__binding_0, __code_7));
suggestions.push((__binding_1, __code_8));
diag.store_args();
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the delimiters should be `(` and `)`")));
diag.multipart_suggestion_with_style(__message, suggestions,
rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
826#[multipart_suggestion(
827 "the delimiters should be `(` and `)`",
828 applicability = "machine-applicable"
829)]
830pub(crate) struct MetaBadDelimSugg {
831 #[suggestion_part(code = "(")]
832 pub open: Span,
833 #[suggestion_part(code = ")")]
834 pub close: Span,
835}
836
837#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
InvalidMetaItem 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 {
InvalidMetaItem {
span: __binding_0,
descr: __binding_1,
quote_ident_sugg: __binding_2,
remove_neg_sugg: __binding_3,
label: __binding_4 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected a literal (`1u8`, `1.0f32`, `\"string\"`, etc.) here, found {$descr}")));
;
diag.arg("descr", __binding_1);
diag.span(__binding_0);
if let Some(__binding_2) = __binding_2 {
diag.subdiagnostic(__binding_2);
}
if let Some(__binding_3) = __binding_3 {
diag.subdiagnostic(__binding_3);
}
if let Some(__binding_4) = __binding_4 {
diag.span_label(__binding_4,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$descr}s are not allowed here")));
}
diag
}
}
}
}
};Diagnostic)]
838#[diag("expected a literal (`1u8`, `1.0f32`, `\"string\"`, etc.) here, found {$descr}")]
839pub(crate) struct InvalidMetaItem {
840 #[primary_span]
841 pub span: Span,
842 pub descr: String,
843 #[subdiagnostic]
844 pub quote_ident_sugg: Option<InvalidMetaItemQuoteIdentSugg>,
845 #[subdiagnostic]
846 pub remove_neg_sugg: Option<InvalidMetaItemRemoveNegSugg>,
847 #[label("{$descr}s are not allowed here")]
848 pub label: Option<Span>,
849}
850
851#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for InvalidMetaItemQuoteIdentSugg {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
InvalidMetaItemQuoteIdentSugg {
before: __binding_0, after: __binding_1 } => {
let mut suggestions = Vec::new();
let __code_9 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!("\""))
});
let __code_10 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!("\""))
});
suggestions.push((__binding_0, __code_9));
suggestions.push((__binding_1, __code_10));
diag.store_args();
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("surround the identifier with quotation marks to make it into a string literal")));
diag.multipart_suggestion_with_style(__message, suggestions,
rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
852#[multipart_suggestion(
853 "surround the identifier with quotation marks to make it into a string literal",
854 applicability = "machine-applicable"
855)]
856pub(crate) struct InvalidMetaItemQuoteIdentSugg {
857 #[suggestion_part(code = "\"")]
858 pub before: Span,
859 #[suggestion_part(code = "\"")]
860 pub after: Span,
861}
862
863#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for InvalidMetaItemRemoveNegSugg {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
InvalidMetaItemRemoveNegSugg { negative_sign: __binding_0 }
=> {
let mut suggestions = Vec::new();
let __code_11 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
});
suggestions.push((__binding_0, __code_11));
diag.store_args();
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("negative numbers are not literals, try removing the `-` sign")));
diag.multipart_suggestion_with_style(__message, suggestions,
rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
864#[multipart_suggestion(
865 "negative numbers are not literals, try removing the `-` sign",
866 applicability = "machine-applicable"
867)]
868pub(crate) struct InvalidMetaItemRemoveNegSugg {
869 #[suggestion_part(code = "")]
870 pub negative_sign: Span,
871}
872
873#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
SuffixedLiteralInAttribute 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 {
SuffixedLiteralInAttribute { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("suffixed literals are not allowed in attributes")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
874#[diag("suffixed literals are not allowed in attributes")]
875#[help(
876 "instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)"
877)]
878pub(crate) struct SuffixedLiteralInAttribute {
879 #[primary_span]
880 pub span: Span,
881}
882
883#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for EmptyLinkName
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 {
EmptyLinkName { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("link name must not be empty")));
diag.code(E0454);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("empty link name")));
diag
}
}
}
}
};Diagnostic)]
884#[diag("link name must not be empty", code = E0454)]
885pub(crate) struct EmptyLinkName {
886 #[primary_span]
887 #[label("empty link name")]
888 pub span: Span,
889}
890
891#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
LinkFrameworkApple 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 {
LinkFrameworkApple { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("link kind `framework` is only supported on Apple targets")));
diag.code(E0455);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
892#[diag("link kind `framework` is only supported on Apple targets", code = E0455)]
893pub(crate) struct LinkFrameworkApple {
894 #[primary_span]
895 pub span: Span,
896}
897
898#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
IncompatibleWasmLink 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 {
IncompatibleWasmLink { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`wasm_import_module` is incompatible with other arguments in `#[link]` attributes")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
899#[diag("`wasm_import_module` is incompatible with other arguments in `#[link]` attributes")]
900pub(crate) struct IncompatibleWasmLink {
901 #[primary_span]
902 pub span: Span,
903}
904
905#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
LinkRequiresName 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 {
LinkRequiresName { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[link]` attribute requires a `name = \"string\"` argument")));
diag.code(E0459);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing `name` argument")));
diag
}
}
}
}
};Diagnostic)]
906#[diag("`#[link]` attribute requires a `name = \"string\"` argument", code = E0459)]
907pub(crate) struct LinkRequiresName {
908 #[primary_span]
909 #[label("missing `name` argument")]
910 pub span: Span,
911}
912
913#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for RawDylibNoNul
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 {
RawDylibNoNul { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("link name must not contain NUL characters if link kind is `raw-dylib`")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
914#[diag("link name must not contain NUL characters if link kind is `raw-dylib`")]
915pub(crate) struct RawDylibNoNul {
916 #[primary_span]
917 pub span: Span,
918}
919
920#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
RawDylibOnlyWindows 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 {
RawDylibOnlyWindows { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("link kind `raw-dylib` is only supported on Windows targets")));
diag.code(E0455);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
921#[diag("link kind `raw-dylib` is only supported on Windows targets", code = E0455)]
922pub(crate) struct RawDylibOnlyWindows {
923 #[primary_span]
924 pub span: Span,
925}
926
927#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
InvalidLinkModifier 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 {
InvalidLinkModifier { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed, export-symbols")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
928#[diag(
929 "invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed, export-symbols"
930)]
931pub(crate) struct InvalidLinkModifier {
932 #[primary_span]
933 pub span: Span,
934}
935
936#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
MultipleModifiers 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 {
MultipleModifiers { span: __binding_0, modifier: __binding_1
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple `{$modifier}` modifiers in a single `modifiers` argument")));
;
diag.arg("modifier", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
937#[diag("multiple `{$modifier}` modifiers in a single `modifiers` argument")]
938pub(crate) struct MultipleModifiers {
939 #[primary_span]
940 pub span: Span,
941 pub modifier: Symbol,
942}
943
944#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ImportNameTypeX86 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 {
ImportNameTypeX86 { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("import name type is only supported on x86")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
945#[diag("import name type is only supported on x86")]
946pub(crate) struct ImportNameTypeX86 {
947 #[primary_span]
948 pub span: Span,
949}
950
951#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
BundleNeedsStatic 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 {
BundleNeedsStatic { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("linking modifier `bundle` is only compatible with `static` linking kind")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
952#[diag("linking modifier `bundle` is only compatible with `static` linking kind")]
953pub(crate) struct BundleNeedsStatic {
954 #[primary_span]
955 pub span: Span,
956}
957
958#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ExportSymbolsNeedsStatic 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 {
ExportSymbolsNeedsStatic { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("linking modifier `export-symbols` is only compatible with `static` linking kind")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
959#[diag("linking modifier `export-symbols` is only compatible with `static` linking kind")]
960pub(crate) struct ExportSymbolsNeedsStatic {
961 #[primary_span]
962 pub span: Span,
963}
964
965#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
WholeArchiveNeedsStatic 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 {
WholeArchiveNeedsStatic { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("linking modifier `whole-archive` is only compatible with `static` linking kind")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
966#[diag("linking modifier `whole-archive` is only compatible with `static` linking kind")]
967pub(crate) struct WholeArchiveNeedsStatic {
968 #[primary_span]
969 pub span: Span,
970}
971
972#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
AsNeededCompatibility 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 {
AsNeededCompatibility { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("linking modifier `as-needed` is only compatible with `dylib`, `framework` and `raw-dylib` linking kinds")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
973#[diag(
974 "linking modifier `as-needed` is only compatible with `dylib`, `framework` and `raw-dylib` linking kinds"
975)]
976pub(crate) struct AsNeededCompatibility {
977 #[primary_span]
978 pub span: Span,
979}
980
981#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ImportNameTypeRaw 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 {
ImportNameTypeRaw { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("import name type can only be used with link kind `raw-dylib`")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
982#[diag("import name type can only be used with link kind `raw-dylib`")]
983pub(crate) struct ImportNameTypeRaw {
984 #[primary_span]
985 pub span: Span,
986}
987
988#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
LimitInvalid<'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 {
LimitInvalid {
span: __binding_0,
value_span: __binding_1,
error_str: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`limit` must be a non-negative integer")));
;
diag.arg("error_str", __binding_2);
diag.span(__binding_0);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$error_str}")));
diag
}
}
}
}
};Diagnostic)]
989#[diag("`limit` must be a non-negative integer")]
990pub(crate) struct LimitInvalid<'a> {
991 #[primary_span]
992 pub span: Span,
993 #[label("{$error_str}")]
994 pub value_span: Span,
995 pub error_str: &'a str,
996}
997
998#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
CfgAttrBadDelim 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 {
CfgAttrBadDelim { span: __binding_0, sugg: __binding_1 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("wrong `cfg_attr` delimiters")));
;
diag.span(__binding_0);
diag.subdiagnostic(__binding_1);
diag
}
}
}
}
};Diagnostic)]
999#[diag("wrong `cfg_attr` delimiters")]
1000pub(crate) struct CfgAttrBadDelim {
1001 #[primary_span]
1002 pub span: Span,
1003 #[subdiagnostic]
1004 pub sugg: MetaBadDelimSugg,
1005}
1006
1007#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
DocAliasMalformed 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 {
DocAliasMalformed { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("doc alias attribute expects a string `#[doc(alias = \"a\")]` or a list of strings `#[doc(alias(\"a\", \"b\"))]`")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1008#[diag(
1009 "doc alias attribute expects a string `#[doc(alias = \"a\")]` or a list of strings `#[doc(alias(\"a\", \"b\"))]`"
1010)]
1011pub(crate) struct DocAliasMalformed {
1012 #[primary_span]
1013 pub span: Span,
1014}
1015
1016#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
UnknownLangItem 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 {
UnknownLangItem { span: __binding_0, name: __binding_1 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("definition of an unknown lang item: `{$name}`")));
diag.code(E0522);
;
diag.arg("name", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("definition of unknown lang item `{$name}`")));
diag
}
}
}
}
};Diagnostic)]
1017#[diag("definition of an unknown lang item: `{$name}`", code = E0522)]
1018pub(crate) struct UnknownLangItem {
1019 #[primary_span]
1020 #[label("definition of unknown lang item `{$name}`")]
1021 pub span: Span,
1022 pub name: Symbol,
1023}
1024
1025#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
UnsupportedInstructionSet<'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 {
UnsupportedInstructionSet {
span: __binding_0,
instruction_set: __binding_1,
current_target: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("target `{$current_target}` does not support `#[instruction_set({$instruction_set}::*)]`")));
;
diag.arg("instruction_set", __binding_1);
diag.arg("current_target", __binding_2);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1026#[diag("target `{$current_target}` does not support `#[instruction_set({$instruction_set}::*)]`")]
1027pub(crate) struct UnsupportedInstructionSet<'a> {
1028 #[primary_span]
1029 pub span: Span,
1030 pub instruction_set: Symbol,
1031 pub current_target: &'a TargetTuple,
1032}