@@ -17,6 +17,11 @@ use rustc_span::symbol::{kw, sym, Symbol};
1717use rustc_span:: Span ;
1818
1919declare_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.
2025 pub rustc:: DEFAULT_HASH_TYPES ,
2126 Allow ,
2227 "forbid HashMap and HashSet and suggest the FxHash* variants" ,
@@ -67,6 +72,12 @@ fn typeck_results_of_method_fn<'tcx>(
6772}
6873
6974declare_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.
7081 pub rustc:: POTENTIAL_QUERY_INSTABILITY ,
7182 Allow ,
7283 "require explicit opt-in when using potentially unstable methods or functions" ,
@@ -92,13 +103,17 @@ impl LateLintPass<'_> for QueryStability {
92103}
93104
94105declare_tool_lint ! {
106+ /// The `usage_of_ty_tykind` lint detects usages of `ty::TyKind::<kind>`,
107+ /// where `ty::<kind>` would suffice.
95108 pub rustc:: USAGE_OF_TY_TYKIND ,
96109 Allow ,
97110 "usage of `ty::TyKind` outside of the `ty::sty` module" ,
98111 report_in_external_macro: true
99112}
100113
101114declare_tool_lint ! {
115+ /// The `usage_of_qualified_ty` lint detects usages of `ty::TyKind`,
116+ /// where `Ty` should be used instead.
102117 pub rustc:: USAGE_OF_QUALIFIED_TY ,
103118 Allow ,
104119 "using `ty::{Ty,TyCtxt}` instead of importing it" ,
@@ -254,6 +269,8 @@ fn gen_args(segment: &PathSegment<'_>) -> String {
254269}
255270
256271declare_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`].
257274 pub rustc:: LINT_PASS_IMPL_WITHOUT_MACRO ,
258275 Allow ,
259276 "`impl LintPass` without the `declare_lint_pass!` or `impl_lint_pass!` macros"
@@ -285,6 +302,8 @@ impl EarlyLintPass for LintPassImpl {
285302}
286303
287304declare_tool_lint ! {
305+ /// The `existing_doc_keyword` lint detects use `#[doc()]` keywords
306+ /// that don't exist, e.g. `#[doc(keyword = "..")]`.
288307 pub rustc:: EXISTING_DOC_KEYWORD ,
289308 Allow ,
290309 "Check that documented keywords in std and core actually exist" ,
@@ -325,13 +344,22 @@ impl<'tcx> LateLintPass<'tcx> for ExistingDocKeyword {
325344}
326345
327346declare_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).
328351 pub rustc:: UNTRANSLATABLE_DIAGNOSTIC ,
329352 Allow ,
330353 "prevent creation of diagnostics which cannot be translated" ,
331354 report_in_external_macro: true
332355}
333356
334357declare_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).
335363 pub rustc:: DIAGNOSTIC_OUTSIDE_OF_IMPL ,
336364 Allow ,
337365 "prevent creation of diagnostics outside of `IntoDiagnostic`/`AddToDiagnostic` impls" ,
@@ -396,6 +424,8 @@ impl LateLintPass<'_> for Diagnostics {
396424}
397425
398426declare_tool_lint ! {
427+ /// The `bad_opt_access` lint detects accessing options by field instad of
428+ /// the wrapper function.
399429 pub rustc:: BAD_OPT_ACCESS ,
400430 Deny ,
401431 "prevent using options by field access when there is a wrapper function" ,
0 commit comments