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