1 use rustc_errors::{Applicability, MultiSpan};
2 use rustc_macros::{LintDiagnostic, SessionDiagnostic};
3 use rustc_span::{Span, Symbol};
5 #[derive(LintDiagnostic)]
6 #[lint(passes::outer_crate_level_attr)]
7 pub struct OuterCrateLevelAttr;
9 #[derive(LintDiagnostic)]
10 #[lint(passes::inner_crate_level_attr)]
11 pub struct InnerCrateLevelAttr;
13 #[derive(LintDiagnostic)]
14 #[lint(passes::ignored_attr_with_macro)]
15 pub struct IgnoredAttrWithMacro<'a> {
19 #[derive(LintDiagnostic)]
20 #[lint(passes::ignored_attr)]
21 pub struct IgnoredAttr<'a> {
25 #[derive(LintDiagnostic)]
26 #[lint(passes::inline_ignored_function_prototype)]
27 pub struct IgnoredInlineAttrFnProto;
29 #[derive(LintDiagnostic)]
30 #[lint(passes::inline_ignored_constants)]
33 pub struct IgnoredInlineAttrConstants;
35 #[derive(SessionDiagnostic)]
36 #[error(passes::inline_not_fn_or_closure, code = "E0518")]
37 pub struct InlineNotFnOrClosure {
44 #[derive(LintDiagnostic)]
45 #[lint(passes::no_coverage_ignored_function_prototype)]
46 pub struct IgnoredNoCoverageFnProto;
48 #[derive(LintDiagnostic)]
49 #[lint(passes::no_coverage_propagate)]
50 pub struct IgnoredNoCoveragePropagate;
52 #[derive(LintDiagnostic)]
53 #[lint(passes::no_coverage_fn_defn)]
54 pub struct IgnoredNoCoverageFnDefn;
56 #[derive(SessionDiagnostic)]
57 #[error(passes::no_coverage_not_coverable, code = "E0788")]
58 pub struct IgnoredNoCoverageNotCoverable {
65 #[derive(SessionDiagnostic)]
66 #[error(passes::should_be_applied_to_fn)]
67 pub struct AttrShouldBeAppliedToFn {
74 #[derive(SessionDiagnostic)]
75 #[error(passes::naked_tracked_caller, code = "E0736")]
76 pub struct NakedTrackedCaller {
81 #[derive(SessionDiagnostic)]
82 #[error(passes::should_be_applied_to_fn, code = "E0739")]
83 pub struct TrackedCallerWrongLocation {
90 #[derive(SessionDiagnostic)]
91 #[error(passes::should_be_applied_to_struct_enum, code = "E0701")]
92 pub struct NonExhaustiveWrongLocation {
99 #[derive(SessionDiagnostic)]
100 #[error(passes::should_be_applied_to_trait)]
101 pub struct AttrShouldBeAppliedToTrait {
108 #[derive(LintDiagnostic)]
109 #[lint(passes::target_feature_on_statement)]
110 pub struct TargetFeatureOnStatement;
112 #[derive(SessionDiagnostic)]
113 #[error(passes::should_be_applied_to_static)]
114 pub struct AttrShouldBeAppliedToStatic {
121 #[derive(SessionDiagnostic)]
122 #[error(passes::doc_expect_str)]
123 pub struct DocExpectStr<'a> {
126 pub attr_name: &'a str,
129 #[derive(SessionDiagnostic)]
130 #[error(passes::doc_alias_empty)]
131 pub struct DocAliasEmpty<'a> {
134 pub attr_str: &'a str,
137 #[derive(SessionDiagnostic)]
138 #[error(passes::doc_alias_bad_char)]
139 pub struct DocAliasBadChar<'a> {
142 pub attr_str: &'a str,
146 #[derive(SessionDiagnostic)]
147 #[error(passes::doc_alias_start_end)]
148 pub struct DocAliasStartEnd<'a> {
151 pub attr_str: &'a str,
154 #[derive(SessionDiagnostic)]
155 #[error(passes::doc_alias_bad_location)]
156 pub struct DocAliasBadLocation<'a> {
159 pub attr_str: &'a str,
160 pub location: &'a str,
163 #[derive(SessionDiagnostic)]
164 #[error(passes::doc_alias_not_an_alias)]
165 pub struct DocAliasNotAnAlias<'a> {
168 pub attr_str: &'a str,
171 #[derive(LintDiagnostic)]
172 #[lint(passes::doc_alias_duplicated)]
173 pub struct DocAliasDuplicated {
175 pub first_defn: Span,
178 #[derive(SessionDiagnostic)]
179 #[error(passes::doc_alias_not_string_literal)]
180 pub struct DocAliasNotStringLiteral {
185 #[derive(SessionDiagnostic)]
186 #[error(passes::doc_alias_malformed)]
187 pub struct DocAliasMalformed {
192 #[derive(SessionDiagnostic)]
193 #[error(passes::doc_keyword_empty_mod)]
194 pub struct DocKeywordEmptyMod {
199 #[derive(SessionDiagnostic)]
200 #[error(passes::doc_keyword_not_mod)]
201 pub struct DocKeywordNotMod {
206 #[derive(SessionDiagnostic)]
207 #[error(passes::doc_keyword_invalid_ident)]
208 pub struct DocKeywordInvalidIdent {
211 pub doc_keyword: Symbol,
214 #[derive(SessionDiagnostic)]
215 #[error(passes::doc_fake_variadic_not_valid)]
216 pub struct DocFakeVariadicNotValid {
221 #[derive(SessionDiagnostic)]
222 #[error(passes::doc_keyword_only_impl)]
223 pub struct DocKeywordOnlyImpl {
228 #[derive(SessionDiagnostic)]
229 #[error(passes::doc_inline_conflict)]
231 pub struct DocKeywordConflict {
233 pub spans: MultiSpan,
236 #[derive(LintDiagnostic)]
237 #[lint(passes::doc_inline_only_use)]
239 pub struct DocInlineOnlyUse {
242 #[label(passes::not_a_use_item_label)]
243 pub item_span: Option<Span>,
246 #[derive(SessionDiagnostic)]
247 #[error(passes::doc_attr_not_crate_level)]
248 pub struct DocAttrNotCrateLevel<'a> {
251 pub attr_name: &'a str,
254 #[derive(LintDiagnostic)]
255 #[lint(passes::doc_test_unknown)]
256 pub struct DocTestUnknown {
260 #[derive(LintDiagnostic)]
261 #[lint(passes::doc_test_takes_list)]
262 pub struct DocTestTakesList;
264 #[derive(LintDiagnostic)]
265 #[lint(passes::doc_primitive)]
266 pub struct DocPrimitive;
268 #[derive(LintDiagnostic)]
269 #[lint(passes::doc_test_unknown_any)]
270 pub struct DocTestUnknownAny {
274 #[derive(LintDiagnostic)]
275 #[lint(passes::doc_test_unknown_spotlight)]
277 #[note(passes::no_op_note)]
278 pub struct DocTestUnknownSpotlight {
280 #[suggestion_short(applicability = "machine-applicable", code = "notable_trait")]
284 #[derive(LintDiagnostic)]
285 #[lint(passes::doc_test_unknown_include)]
286 pub struct DocTestUnknownInclude {
289 pub inner: &'static str,
290 #[suggestion(code = "#{inner}[doc = include_str!(\"{value}\")]")]
291 pub sugg: (Span, Applicability),
294 #[derive(LintDiagnostic)]
295 #[lint(passes::doc_invalid)]
296 pub struct DocInvalid;
298 #[derive(SessionDiagnostic)]
299 #[error(passes::pass_by_value)]
300 pub struct PassByValue {
307 #[derive(SessionDiagnostic)]
308 #[error(passes::allow_incoherent_impl)]
309 pub struct AllowIncoherentImpl {
316 #[derive(SessionDiagnostic)]
317 #[error(passes::has_incoherent_inherent_impl)]
318 pub struct HasIncoherentInherentImpl {
325 #[derive(LintDiagnostic)]
326 #[lint(passes::must_use_async)]
327 pub struct MustUseAsync {
332 #[derive(LintDiagnostic)]
333 #[lint(passes::must_use_no_effect)]
334 pub struct MustUseNoEffect {
335 pub article: &'static str,
336 pub target: rustc_hir::Target,
339 #[derive(SessionDiagnostic)]
340 #[error(passes::must_not_suspend)]
341 pub struct MustNotSuspend {
348 #[derive(LintDiagnostic)]
349 #[lint(passes::cold)]
356 #[derive(LintDiagnostic)]
357 #[lint(passes::link)]
361 pub span: Option<Span>,