@@ -17,6 +17,11 @@ use rustc_span::symbol::{kw, sym, Symbol};
17
17
use rustc_span:: Span ;
18
18
19
19
declare_tool_lint ! {
20
+ /// The `default_hash_type` lint detects use of [`std::collections::HashMap`]/[`std::collections::HashSet`],
21
+ /// suggesting the use of `FxHashMap`/`FxHashSet`.
22
+ ///
23
+ /// This can help as `FxHasher` can perform better than the default hasher. DOS protection is not
24
+ /// required as input is assumed to be trusted.
20
25
pub rustc:: DEFAULT_HASH_TYPES ,
21
26
Allow ,
22
27
"forbid HashMap and HashSet and suggest the FxHash* variants" ,
@@ -67,6 +72,12 @@ fn typeck_results_of_method_fn<'tcx>(
67
72
}
68
73
69
74
declare_tool_lint ! {
75
+ /// The `potential_query_instability` lint detects use of methods which can lead to
76
+ /// potential query instability, such as iterating over a `HashMap`.
77
+ ///
78
+ /// Due to the [incremental compilation](https://rustc-dev-guide.rust-lang.org/queries/incremental-compilation.html) model,
79
+ /// queries must return deterministic, stable results. `HashMap` iteration order can change between compilations,
80
+ /// and will introduce instability if query results expose the order.
70
81
pub rustc:: POTENTIAL_QUERY_INSTABILITY ,
71
82
Allow ,
72
83
"require explicit opt-in when using potentially unstable methods or functions" ,
@@ -92,13 +103,17 @@ impl LateLintPass<'_> for QueryStability {
92
103
}
93
104
94
105
declare_tool_lint ! {
106
+ /// The `usage_of_ty_tykind` lint detects usages of `ty::TyKind::<kind>`,
107
+ /// where `ty::<kind>` would suffice.
95
108
pub rustc:: USAGE_OF_TY_TYKIND ,
96
109
Allow ,
97
110
"usage of `ty::TyKind` outside of the `ty::sty` module" ,
98
111
report_in_external_macro: true
99
112
}
100
113
101
114
declare_tool_lint ! {
115
+ /// The `usage_of_qualified_ty` lint detects usages of `ty::TyKind`,
116
+ /// where `Ty` should be used instead.
102
117
pub rustc:: USAGE_OF_QUALIFIED_TY ,
103
118
Allow ,
104
119
"using `ty::{Ty,TyCtxt}` instead of importing it" ,
@@ -254,6 +269,8 @@ fn gen_args(segment: &PathSegment<'_>) -> String {
254
269
}
255
270
256
271
declare_tool_lint ! {
272
+ /// The `lint_pass_impl_without_macro` detects manual implementations of a lint
273
+ /// pass, without using [`declare_lint_pass`] or [`impl_lint_pass`].
257
274
pub rustc:: LINT_PASS_IMPL_WITHOUT_MACRO ,
258
275
Allow ,
259
276
"`impl LintPass` without the `declare_lint_pass!` or `impl_lint_pass!` macros"
@@ -285,6 +302,8 @@ impl EarlyLintPass for LintPassImpl {
285
302
}
286
303
287
304
declare_tool_lint ! {
305
+ /// The `existing_doc_keyword` lint detects use `#[doc()]` keywords
306
+ /// that don't exist, e.g. `#[doc(keyword = "..")]`.
288
307
pub rustc:: EXISTING_DOC_KEYWORD ,
289
308
Allow ,
290
309
"Check that documented keywords in std and core actually exist" ,
@@ -325,13 +344,22 @@ impl<'tcx> LateLintPass<'tcx> for ExistingDocKeyword {
325
344
}
326
345
327
346
declare_tool_lint ! {
347
+ /// The `untranslatable_diagnostic` lint detects diagnostics created
348
+ /// without using translatable Fluent strings.
349
+ ///
350
+ /// More details on translatable diagnostics can be found [here](https://rustc-dev-guide.rust-lang.org/diagnostics/translation.html).
328
351
pub rustc:: UNTRANSLATABLE_DIAGNOSTIC ,
329
352
Allow ,
330
353
"prevent creation of diagnostics which cannot be translated" ,
331
354
report_in_external_macro: true
332
355
}
333
356
334
357
declare_tool_lint ! {
358
+ /// The `diagnostic_outside_of_impl` lint detects diagnostics created manually,
359
+ /// and inside an `IntoDiagnostic`/`AddToDiagnostic` implementation,
360
+ /// or a `#[derive(Diagnostic)]`/`#[derive(Subdiagnostic)]` expansion.
361
+ ///
362
+ /// More details on diagnostics implementations can be found [here](https://rustc-dev-guide.rust-lang.org/diagnostics/diagnostic-structs.html).
335
363
pub rustc:: DIAGNOSTIC_OUTSIDE_OF_IMPL ,
336
364
Allow ,
337
365
"prevent creation of diagnostics outside of `IntoDiagnostic`/`AddToDiagnostic` impls" ,
@@ -396,6 +424,8 @@ impl LateLintPass<'_> for Diagnostics {
396
424
}
397
425
398
426
declare_tool_lint ! {
427
+ /// The `bad_opt_access` lint detects accessing options by field instad of
428
+ /// the wrapper function.
399
429
pub rustc:: BAD_OPT_ACCESS ,
400
430
Deny ,
401
431
"prevent using options by field access when there is a wrapper function" ,
0 commit comments