]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_lint/src/lib.rs
New upstream version 1.64.0+dfsg1
[rustc.git] / compiler / rustc_lint / src / lib.rs
CommitLineData
dfeec247 1//! Lints, aka compiler warnings.
c34b1796 2//!
dfeec247
XL
3//! A 'lint' check is a kind of miscellaneous constraint that a user _might_
4//! want to enforce, but might reasonably want to permit as well, on a
5//! module-by-module basis. They contrast with static constraints enforced by
6//! other phases of the compiler, which are generally required to hold in order
7//! to compile the program at all.
8//!
f9f354fc 9//! Most lints can be written as [LintPass] instances. These run after
dfeec247 10//! all other analyses. The `LintPass`es built into rustc are defined
f9f354fc 11//! within [rustc_session::lint::builtin],
dfeec247
XL
12//! which has further comments on how to add such a lint.
13//! rustc can also load user-defined lint plugins via the plugin mechanism.
14//!
15//! Some of rustc's lints are defined elsewhere in the compiler and work by
16//! calling `add_lint()` on the overall `Session` object. This works when
17//! it happens before the main lint pass, which emits the lints stored by
18//! `add_lint()`. To emit lints after the main lint pass (from codegen, for
19//! example) requires more effort. See `emit_lint` and `GatherNodeLevels`
20//! in `context.rs`.
21//!
f9f354fc 22//! Some code also exists in [rustc_session::lint], [rustc_middle::lint].
c34b1796 23//!
0731742a 24//! ## Note
c34b1796
AL
25//!
26//! This API is completely unstable and subject to change.
27
5e7ed085 28#![allow(rustc::potential_query_instability)]
1b1a35ee 29#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
1b1a35ee 30#![feature(array_windows)]
5869c6ff 31#![feature(box_patterns)]
5e7ed085 32#![feature(control_flow_enum)]
5099ac24 33#![feature(if_let_guard)]
5e7ed085 34#![feature(iter_intersperse)]
f035d41b 35#![feature(iter_order_by)]
5e7ed085 36#![feature(let_chains)]
a2a8927a 37#![feature(let_else)]
dfeec247 38#![feature(never_type)]
dfeec247 39#![recursion_limit = "256"]
0731742a 40
c34b1796 41#[macro_use]
ba9703b0 42extern crate rustc_middle;
60c5eb7d
XL
43#[macro_use]
44extern crate rustc_session;
c34b1796 45
60c5eb7d 46mod array_into_iter;
dfeec247
XL
47pub mod builtin;
48mod context;
49mod early;
c295e0f8 50mod enum_intrinsics_non_enums;
5e7ed085 51mod expect;
c295e0f8 52pub mod hidden_unicode_codepoints;
dfeec247
XL
53mod internal;
54mod late;
55mod levels;
29967ef6 56mod methods;
dfeec247 57mod non_ascii_idents;
5869c6ff 58mod non_fmt_panic;
0731742a 59mod nonstandard_style;
6a06907d 60mod noop_method_call;
5099ac24 61mod pass_by_value;
dfeec247 62mod passes;
e1599b0c 63mod redundant_semicolon;
29967ef6 64mod traits;
0731742a
XL
65mod types;
66mod unused;
67
94222f64
XL
68pub use array_into_iter::ARRAY_INTO_ITER;
69
3dfed10e 70use rustc_ast as ast;
dfeec247 71use rustc_hir as hir;
f9f354fc 72use rustc_hir::def_id::LocalDefId;
ba9703b0
XL
73use rustc_middle::ty::query::Providers;
74use rustc_middle::ty::TyCtxt;
dfeec247 75use rustc_session::lint::builtin::{
6a06907d 76 BARE_TRAIT_OBJECTS, ELIDED_LIFETIMES_IN_PATHS, EXPLICIT_OUTLIVES_REQUIREMENTS,
dfeec247 77};
064997fb 78use rustc_span::symbol::Ident;
dfeec247 79use rustc_span::Span;
c34b1796 80
dfeec247 81use array_into_iter::ArrayIntoIter;
b039eaaf 82use builtin::*;
c295e0f8
XL
83use enum_intrinsics_non_enums::EnumIntrinsicsNonEnums;
84use hidden_unicode_codepoints::*;
dfeec247 85use internal::*;
29967ef6 86use methods::*;
dfeec247 87use non_ascii_idents::*;
5869c6ff 88use non_fmt_panic::NonPanicFmt;
dfeec247 89use nonstandard_style::*;
6a06907d 90use noop_method_call::*;
5099ac24 91use pass_by_value::*;
dfeec247 92use redundant_semicolon::*;
29967ef6 93use traits::*;
b039eaaf
SL
94use types::*;
95use unused::*;
c34b1796 96
dfeec247 97/// Useful for other parts of the compiler / Clippy.
94b46f34 98pub use builtin::SoftLints;
5099ac24
FG
99pub use context::{CheckLintNameResult, FindLintError, LintStore};
100pub use context::{EarlyContext, LateContext, LintContext};
101pub use early::{check_ast_node, EarlyCheckNode};
064997fb 102pub use late::{check_crate, unerased_lint_store};
dfeec247
XL
103pub use passes::{EarlyLintPass, LateLintPass};
104pub use rustc_session::lint::Level::{self, *};
105pub use rustc_session::lint::{BufferedEarlyLint, FutureIncompatibleInfo, Lint, LintId};
106pub use rustc_session::lint::{LintArray, LintPass};
94b46f34 107
f035d41b 108pub fn provide(providers: &mut Providers) {
dfeec247 109 levels::provide(providers);
04454e1e 110 expect::provide(providers);
dfeec247 111 *providers = Providers { lint_mod, ..*providers };
532ac7d7
XL
112}
113
f9f354fc 114fn lint_mod(tcx: TyCtxt<'_>, module_def_id: LocalDefId) {
dfeec247 115 late::late_lint_mod(tcx, module_def_id, BuiltinCombinedModuleLateLintPass::new());
532ac7d7
XL
116}
117
9fa01778 118macro_rules! pre_expansion_lint_passes {
dfeec247 119 ($macro:path, $args:tt) => {
74b04a01 120 $macro!($args, [KeywordIdents: KeywordIdents,]);
dfeec247 121 };
9fa01778
XL
122}
123
124macro_rules! early_lint_passes {
dfeec247
XL
125 ($macro:path, $args:tt) => {
126 $macro!(
127 $args,
128 [
129 UnusedParens: UnusedParens,
ba9703b0 130 UnusedBraces: UnusedBraces,
dfeec247
XL
131 UnusedImportBraces: UnusedImportBraces,
132 UnsafeCode: UnsafeCode,
133 AnonymousParameters: AnonymousParameters,
134 EllipsisInclusiveRangePatterns: EllipsisInclusiveRangePatterns::default(),
135 NonCamelCaseTypes: NonCamelCaseTypes,
136 DeprecatedAttr: DeprecatedAttr::new(),
137 WhileTrue: WhileTrue,
138 NonAsciiIdents: NonAsciiIdents,
c295e0f8 139 HiddenUnicodeCodepoints: HiddenUnicodeCodepoints,
dfeec247 140 IncompleteFeatures: IncompleteFeatures,
74b04a01
XL
141 RedundantSemicolons: RedundantSemicolons,
142 UnusedDocComment: UnusedDocComment,
dfeec247
XL
143 ]
144 );
145 };
9fa01778
XL
146}
147
148macro_rules! declare_combined_early_pass {
149 ([$name:ident], $passes:tt) => (
150 early_lint_methods!(declare_combined_early_lint_pass, [pub $name, $passes]);
151 )
152}
153
154pre_expansion_lint_passes!(declare_combined_early_pass, [BuiltinCombinedPreExpansionLintPass]);
155early_lint_passes!(declare_combined_early_pass, [BuiltinCombinedEarlyLintPass]);
156
532ac7d7 157macro_rules! late_lint_passes {
dfeec247
XL
158 ($macro:path, $args:tt) => {
159 $macro!(
160 $args,
161 [
dfeec247
XL
162 // Tracks state across modules
163 UnnameableTestItems: UnnameableTestItems::new(),
164 // Tracks attributes of parents
165 MissingDoc: MissingDoc::new(),
923072b8 166 // Builds a global list of all impls of `Debug`.
dfeec247
XL
167 // FIXME: Turn the computation of types which implement Debug into a query
168 // and change this to a module lint pass
169 MissingDebugImplementations: MissingDebugImplementations::default(),
923072b8 170 // Keeps a global list of foreign declarations.
f035d41b 171 ClashingExternDeclarations: ClashingExternDeclarations::new(),
dfeec247
XL
172 ]
173 );
174 };
532ac7d7
XL
175}
176
177macro_rules! late_lint_mod_passes {
dfeec247
XL
178 ($macro:path, $args:tt) => {
179 $macro!(
180 $args,
181 [
182 HardwiredLints: HardwiredLints,
f035d41b
XL
183 ImproperCTypesDeclarations: ImproperCTypesDeclarations,
184 ImproperCTypesDefinitions: ImproperCTypesDefinitions,
dfeec247
XL
185 VariantSizeDifferences: VariantSizeDifferences,
186 BoxPointers: BoxPointers,
187 PathStatements: PathStatements,
188 // Depends on referenced function signatures in expressions
189 UnusedResults: UnusedResults,
190 NonUpperCaseGlobals: NonUpperCaseGlobals,
191 NonShorthandFieldPatterns: NonShorthandFieldPatterns,
192 UnusedAllocation: UnusedAllocation,
193 // Depends on types used in type definitions
194 MissingCopyImplementations: MissingCopyImplementations,
195 // Depends on referenced function signatures in expressions
196 MutableTransmutes: MutableTransmutes,
197 TypeAliasBounds: TypeAliasBounds,
198 TrivialConstraints: TrivialConstraints,
199 TypeLimits: TypeLimits::new(),
200 NonSnakeCase: NonSnakeCase,
201 InvalidNoMangleItems: InvalidNoMangleItems,
202 // Depends on access levels
203 UnreachablePub: UnreachablePub,
204 ExplicitOutlivesRequirements: ExplicitOutlivesRequirements,
205 InvalidValue: InvalidValue,
cdc7bbd5 206 DerefNullPtr: DerefNullPtr,
923072b8
FG
207 // May Depend on constants elsewhere
208 UnusedBrokenConst: UnusedBrokenConst,
209 UnstableFeatures: UnstableFeatures,
210 ArrayIntoIter: ArrayIntoIter::default(),
211 DropTraitConstraints: DropTraitConstraints,
212 TemporaryCStringAsPtr: TemporaryCStringAsPtr,
213 NonPanicFmt: NonPanicFmt,
214 NoopMethodCall: NoopMethodCall,
215 EnumIntrinsicsNonEnums: EnumIntrinsicsNonEnums,
216 InvalidAtomicOrdering: InvalidAtomicOrdering,
217 NamedAsmLabels: NamedAsmLabels,
dfeec247
XL
218 ]
219 );
220 };
532ac7d7
XL
221}
222
223macro_rules! declare_combined_late_pass {
224 ([$v:vis $name:ident], $passes:tt) => (
225 late_lint_methods!(declare_combined_late_lint_pass, [$v $name, $passes], ['tcx]);
226 )
227}
228
229// FIXME: Make a separate lint type which do not require typeck tables
230late_lint_passes!(declare_combined_late_pass, [pub BuiltinCombinedLateLintPass]);
231
232late_lint_mod_passes!(declare_combined_late_pass, [BuiltinCombinedModuleLateLintPass]);
233
dfeec247
XL
234pub fn new_lint_store(no_interleave_lints: bool, internal_lints: bool) -> LintStore {
235 let mut lint_store = LintStore::new();
e74abb32
XL
236
237 register_builtins(&mut lint_store, no_interleave_lints);
238 if internal_lints {
239 register_internals(&mut lint_store);
240 }
241
242 lint_store
243}
244
c34b1796
AL
245/// Tell the `LintStore` about all the built-in lints (the ones
246/// defined in this crate and the ones defined in
3dfed10e 247/// `rustc_session::lint::builtin`).
dfeec247 248fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {
c34b1796 249 macro_rules! add_lint_group {
e74abb32
XL
250 ($name:expr, $($lint:ident),*) => (
251 store.register_group(false, $name, None, vec![$(LintId::of($lint)),*]);
0bf4aa26 252 )
c34b1796
AL
253 }
254
532ac7d7 255 macro_rules! register_pass {
dfeec247 256 ($method:ident, $ty:ident, $constructor:expr) => {
e74abb32 257 store.register_lints(&$ty::get_lints());
94222f64 258 store.$method(|| Box::new($constructor));
dfeec247 259 };
532ac7d7
XL
260 }
261
9fa01778 262 macro_rules! register_passes {
e74abb32 263 ($method:ident, [$($passes:ident: $constructor:expr,)*]) => (
9fa01778 264 $(
e74abb32 265 register_pass!($method, $passes, $constructor);
9fa01778
XL
266 )*
267 )
268 }
b039eaaf 269
e74abb32
XL
270 if no_interleave_lints {
271 pre_expansion_lint_passes!(register_passes, register_pre_expansion_pass);
272 early_lint_passes!(register_passes, register_early_pass);
273 late_lint_passes!(register_passes, register_late_pass);
274 late_lint_mod_passes!(register_passes, register_late_mod_pass);
9fa01778 275 } else {
e74abb32
XL
276 store.register_lints(&BuiltinCombinedPreExpansionLintPass::get_lints());
277 store.register_lints(&BuiltinCombinedEarlyLintPass::get_lints());
278 store.register_lints(&BuiltinCombinedModuleLateLintPass::get_lints());
279 store.register_lints(&BuiltinCombinedLateLintPass::get_lints());
9fa01778 280 }
c30ab7b3 281
dfeec247
XL
282 add_lint_group!(
283 "nonstandard_style",
284 NON_CAMEL_CASE_TYPES,
285 NON_SNAKE_CASE,
286 NON_UPPER_CASE_GLOBALS
287 );
b7449926 288
dfeec247
XL
289 add_lint_group!(
290 "unused",
291 UNUSED_IMPORTS,
292 UNUSED_VARIABLES,
293 UNUSED_ASSIGNMENTS,
294 DEAD_CODE,
295 UNUSED_MUT,
296 UNREACHABLE_CODE,
297 UNREACHABLE_PATTERNS,
dfeec247
XL
298 UNUSED_MUST_USE,
299 UNUSED_UNSAFE,
300 PATH_STATEMENTS,
301 UNUSED_ATTRIBUTES,
302 UNUSED_MACROS,
04454e1e 303 UNUSED_MACRO_RULES,
dfeec247
XL
304 UNUSED_ALLOCATION,
305 UNUSED_DOC_COMMENTS,
306 UNUSED_EXTERN_CRATES,
307 UNUSED_FEATURES,
308 UNUSED_LABELS,
74b04a01 309 UNUSED_PARENS,
ba9703b0 310 UNUSED_BRACES,
74b04a01 311 REDUNDANT_SEMICOLONS
dfeec247 312 );
b7449926 313
dfeec247
XL
314 add_lint_group!(
315 "rust_2018_idioms",
316 BARE_TRAIT_OBJECTS,
317 UNUSED_EXTERN_CRATES,
318 ELLIPSIS_INCLUSIVE_RANGE_PATTERNS,
319 ELIDED_LIFETIMES_IN_PATHS,
320 EXPLICIT_OUTLIVES_REQUIREMENTS // FIXME(#52665, #47816) not always applicable and not all
321 // macros are ready for this yet.
322 // UNREACHABLE_PUB,
323
324 // FIXME macro crates are not up for this yet, too much
325 // breakage is seen if we try to encourage this lint.
326 // MACRO_USE_EXTERN_CRATE
327 );
0531ce1d 328
0731742a 329 // Register renamed and removed lints.
83c7162d
XL
330 store.register_renamed("single_use_lifetime", "single_use_lifetimes");
331 store.register_renamed("elided_lifetime_in_path", "elided_lifetimes_in_paths");
332 store.register_renamed("bare_trait_object", "bare_trait_objects");
333 store.register_renamed("unstable_name_collision", "unstable_name_collisions");
334 store.register_renamed("unused_doc_comment", "unused_doc_comments");
b7449926 335 store.register_renamed("async_idents", "keyword_idents");
74b04a01
XL
336 store.register_renamed("exceeding_bitshifts", "arithmetic_overflow");
337 store.register_renamed("redundant_semicolon", "redundant_semicolons");
fc512014 338 store.register_renamed("overlapping_patterns", "overlapping_range_endpoints");
cdc7bbd5 339 store.register_renamed("safe_packed_borrows", "unaligned_references");
136023e0
XL
340 store.register_renamed("disjoint_capture_migration", "rust_2021_incompatible_closure_captures");
341 store.register_renamed("or_patterns_back_compat", "rust_2021_incompatible_or_patterns");
342 store.register_renamed("non_fmt_panic", "non_fmt_panics");
6a06907d
XL
343
344 // These were moved to tool lints, but rustc still sees them when compiling normally, before
345 // tool lints are registered, so `check_tool_name_for_backwards_compat` doesn't work. Use
346 // `register_removed` explicitly.
347 const RUSTDOC_LINTS: &[&str] = &[
348 "broken_intra_doc_links",
349 "private_intra_doc_links",
350 "missing_crate_level_docs",
351 "missing_doc_code_examples",
352 "private_doc_tests",
353 "invalid_codeblock_attributes",
354 "invalid_html_tags",
355 "non_autolinks",
356 ];
357 for rustdoc_lint in RUSTDOC_LINTS {
358 store.register_ignored(rustdoc_lint);
359 }
360 store.register_removed(
361 "intra_doc_link_resolution_failure",
362 "use `rustdoc::broken_intra_doc_links` instead",
363 );
364 store.register_removed("rustdoc", "use `rustdoc::all` instead");
365
b7449926 366 store.register_removed("unknown_features", "replaced by an error");
abe05a73 367 store.register_removed("unsigned_negation", "replaced by negate_unsigned feature gate");
9cc50fc6 368 store.register_removed("negate_unsigned", "cast a signed value instead");
92a42be0 369 store.register_removed("raw_pointer_derive", "using derive with raw pointers is ok");
0731742a 370 // Register lint group aliases.
0bf4aa26 371 store.register_group_alias("nonstandard_style", "bad_style");
0731742a
XL
372 // This was renamed to `raw_pointer_derive`, which was then removed,
373 // so it is also considered removed.
abe05a73 374 store.register_removed("raw_pointer_deriving", "using derive with raw pointers is ok");
9e0c209e 375 store.register_removed("drop_with_repr_extern", "drop flags have been removed");
abe05a73
XL
376 store.register_removed("fat_ptr_transmutes", "was accidentally removed back in 2014");
377 store.register_removed("deprecated_attr", "use `deprecated` instead");
dfeec247
XL
378 store.register_removed(
379 "transmute_from_fn_item_types",
380 "always cast functions before transmuting them",
381 );
382 store.register_removed(
383 "hr_lifetime_in_assoc_type",
74b04a01
XL
384 "converted into hard error, see issue #33685 \
385 <https://github.com/rust-lang/rust/issues/33685> for more information",
dfeec247
XL
386 );
387 store.register_removed(
388 "inaccessible_extern_crate",
74b04a01
XL
389 "converted into hard error, see issue #36886 \
390 <https://github.com/rust-lang/rust/issues/36886> for more information",
dfeec247
XL
391 );
392 store.register_removed(
393 "super_or_self_in_global_path",
74b04a01
XL
394 "converted into hard error, see issue #36888 \
395 <https://github.com/rust-lang/rust/issues/36888> for more information",
dfeec247
XL
396 );
397 store.register_removed(
398 "overlapping_inherent_impls",
74b04a01
XL
399 "converted into hard error, see issue #36889 \
400 <https://github.com/rust-lang/rust/issues/36889> for more information",
dfeec247
XL
401 );
402 store.register_removed(
403 "illegal_floating_point_constant_pattern",
74b04a01
XL
404 "converted into hard error, see issue #36890 \
405 <https://github.com/rust-lang/rust/issues/36890> for more information",
dfeec247
XL
406 );
407 store.register_removed(
408 "illegal_struct_or_enum_constant_pattern",
74b04a01
XL
409 "converted into hard error, see issue #36891 \
410 <https://github.com/rust-lang/rust/issues/36891> for more information",
dfeec247
XL
411 );
412 store.register_removed(
413 "lifetime_underscore",
74b04a01
XL
414 "converted into hard error, see issue #36892 \
415 <https://github.com/rust-lang/rust/issues/36892> for more information",
dfeec247
XL
416 );
417 store.register_removed(
418 "extra_requirement_in_impl",
74b04a01
XL
419 "converted into hard error, see issue #37166 \
420 <https://github.com/rust-lang/rust/issues/37166> for more information",
dfeec247
XL
421 );
422 store.register_removed(
423 "legacy_imports",
74b04a01
XL
424 "converted into hard error, see issue #38260 \
425 <https://github.com/rust-lang/rust/issues/38260> for more information",
dfeec247
XL
426 );
427 store.register_removed(
428 "coerce_never",
74b04a01
XL
429 "converted into hard error, see issue #48950 \
430 <https://github.com/rust-lang/rust/issues/48950> for more information",
dfeec247
XL
431 );
432 store.register_removed(
433 "resolve_trait_on_defaulted_unit",
74b04a01
XL
434 "converted into hard error, see issue #48950 \
435 <https://github.com/rust-lang/rust/issues/48950> for more information",
dfeec247
XL
436 );
437 store.register_removed(
438 "private_no_mangle_fns",
439 "no longer a warning, `#[no_mangle]` functions always exported",
440 );
441 store.register_removed(
442 "private_no_mangle_statics",
443 "no longer a warning, `#[no_mangle]` statics always exported",
444 );
445 store.register_removed("bad_repr", "replaced with a generic attribute input check");
446 store.register_removed(
447 "duplicate_matcher_binding_name",
74b04a01
XL
448 "converted into hard error, see issue #57742 \
449 <https://github.com/rust-lang/rust/issues/57742> for more information",
dfeec247
XL
450 );
451 store.register_removed(
452 "incoherent_fundamental_impls",
74b04a01
XL
453 "converted into hard error, see issue #46205 \
454 <https://github.com/rust-lang/rust/issues/46205> for more information",
dfeec247
XL
455 );
456 store.register_removed(
457 "legacy_constructor_visibility",
74b04a01
XL
458 "converted into hard error, see issue #39207 \
459 <https://github.com/rust-lang/rust/issues/39207> for more information",
dfeec247
XL
460 );
461 store.register_removed(
462 "legacy_directory_ownership",
74b04a01
XL
463 "converted into hard error, see issue #37872 \
464 <https://github.com/rust-lang/rust/issues/37872> for more information",
dfeec247
XL
465 );
466 store.register_removed(
467 "safe_extern_statics",
74b04a01
XL
468 "converted into hard error, see issue #36247 \
469 <https://github.com/rust-lang/rust/issues/36247> for more information",
dfeec247
XL
470 );
471 store.register_removed(
472 "parenthesized_params_in_types_and_modules",
74b04a01
XL
473 "converted into hard error, see issue #42238 \
474 <https://github.com/rust-lang/rust/issues/42238> for more information",
dfeec247
XL
475 );
476 store.register_removed(
477 "duplicate_macro_exports",
74b04a01
XL
478 "converted into hard error, see issue #35896 \
479 <https://github.com/rust-lang/rust/issues/35896> for more information",
dfeec247
XL
480 );
481 store.register_removed(
482 "nested_impl_trait",
74b04a01
XL
483 "converted into hard error, see issue #59014 \
484 <https://github.com/rust-lang/rust/issues/59014> for more information",
dfeec247 485 );
60c5eb7d 486 store.register_removed("plugin_as_library", "plugins have been deprecated and retired");
5099ac24
FG
487 store.register_removed(
488 "unsupported_naked_functions",
489 "converted into hard error, see RFC 2972 \
490 <https://github.com/rust-lang/rfcs/blob/master/text/2972-constrained-naked.md> for more information",
491 );
04454e1e
FG
492 store.register_removed(
493 "mutable_borrow_reservation_conflict",
494 "now allowed, see issue #59159 \
495 <https://github.com/rust-lang/rust/issues/59159> for more information",
496 );
c34b1796 497}
532ac7d7 498
dfeec247 499fn register_internals(store: &mut LintStore) {
e74abb32 500 store.register_lints(&LintPassImpl::get_lints());
94222f64 501 store.register_early_pass(|| Box::new(LintPassImpl));
136023e0 502 store.register_lints(&DefaultHashTypes::get_lints());
94222f64 503 store.register_late_pass(|| Box::new(DefaultHashTypes));
5099ac24
FG
504 store.register_lints(&QueryStability::get_lints());
505 store.register_late_pass(|| Box::new(QueryStability));
fc512014 506 store.register_lints(&ExistingDocKeyword::get_lints());
94222f64 507 store.register_late_pass(|| Box::new(ExistingDocKeyword));
e74abb32 508 store.register_lints(&TyTyKind::get_lints());
94222f64 509 store.register_late_pass(|| Box::new(TyTyKind));
923072b8
FG
510 store.register_lints(&Diagnostics::get_lints());
511 store.register_late_pass(|| Box::new(Diagnostics));
064997fb
FG
512 store.register_lints(&BadOptAccess::get_lints());
513 store.register_late_pass(|| Box::new(BadOptAccess));
5099ac24
FG
514 store.register_lints(&PassByValue::get_lints());
515 store.register_late_pass(|| Box::new(PassByValue));
064997fb
FG
516 // FIXME(davidtwco): deliberately do not include `UNTRANSLATABLE_DIAGNOSTIC` and
517 // `DIAGNOSTIC_OUTSIDE_OF_IMPL` here because `-Wrustc::internal` is provided to every crate and
518 // these lints will trigger all of the time - change this once migration to diagnostic structs
519 // and translation is completed
532ac7d7 520 store.register_group(
532ac7d7 521 false,
416331ca 522 "rustc::internal",
532ac7d7
XL
523 None,
524 vec![
525 LintId::of(DEFAULT_HASH_TYPES),
5099ac24 526 LintId::of(POTENTIAL_QUERY_INSTABILITY),
532ac7d7 527 LintId::of(USAGE_OF_TY_TYKIND),
5099ac24 528 LintId::of(PASS_BY_VALUE),
416331ca 529 LintId::of(LINT_PASS_IMPL_WITHOUT_MACRO),
48663c56 530 LintId::of(USAGE_OF_QUALIFIED_TY),
fc512014 531 LintId::of(EXISTING_DOC_KEYWORD),
064997fb 532 LintId::of(BAD_OPT_ACCESS),
532ac7d7
XL
533 ],
534 );
535}
136023e0
XL
536
537#[cfg(test)]
538mod tests;