44//! compiler code, rather than using their own custom pass. Those
55//! lints are all available in `rustc_lint::builtin`.
66
7- use crate :: lint:: { LintPass , LateLintPass , LintArray } ;
7+ use crate :: lint:: { LintPass , LateLintPass , LintArray , FutureIncompatibleInfo } ;
88use crate :: middle:: stability;
99use crate :: session:: Session ;
1010use errors:: { Applicability , DiagnosticBuilder , pluralise} ;
1111use syntax:: ast;
12+ use syntax:: edition:: Edition ;
1213use syntax:: source_map:: Span ;
1314use syntax:: symbol:: Symbol ;
1415
@@ -125,7 +126,11 @@ declare_lint! {
125126declare_lint ! {
126127 pub PRIVATE_IN_PUBLIC ,
127128 Warn ,
128- "detect private items in public interfaces not caught by the old implementation"
129+ "detect private items in public interfaces not caught by the old implementation" ,
130+ @future_incompatible = FutureIncompatibleInfo {
131+ reference: "issue #34537 <https://github.com/rust-lang/rust/issues/34537>" ,
132+ edition: None ,
133+ } ;
129134}
130135
131136declare_lint ! {
@@ -137,13 +142,21 @@ declare_lint! {
137142declare_lint ! {
138143 pub PUB_USE_OF_PRIVATE_EXTERN_CRATE ,
139144 Deny ,
140- "detect public re-exports of private extern crates"
145+ "detect public re-exports of private extern crates" ,
146+ @future_incompatible = FutureIncompatibleInfo {
147+ reference: "issue #34537 <https://github.com/rust-lang/rust/issues/34537>" ,
148+ edition: None ,
149+ } ;
141150}
142151
143152declare_lint ! {
144153 pub INVALID_TYPE_PARAM_DEFAULT ,
145154 Deny ,
146- "type parameter default erroneously allowed in invalid location"
155+ "type parameter default erroneously allowed in invalid location" ,
156+ @future_incompatible = FutureIncompatibleInfo {
157+ reference: "issue #36887 <https://github.com/rust-lang/rust/issues/36887>" ,
158+ edition: None ,
159+ } ;
147160}
148161
149162declare_lint ! {
@@ -155,56 +168,92 @@ declare_lint! {
155168declare_lint ! {
156169 pub SAFE_EXTERN_STATICS ,
157170 Deny ,
158- "safe access to extern statics was erroneously allowed"
171+ "safe access to extern statics was erroneously allowed" ,
172+ @future_incompatible = FutureIncompatibleInfo {
173+ reference: "issue #36247 <https://github.com/rust-lang/rust/issues/36247>" ,
174+ edition: None ,
175+ } ;
159176}
160177
161178declare_lint ! {
162179 pub SAFE_PACKED_BORROWS ,
163180 Warn ,
164- "safe borrows of fields of packed structs were was erroneously allowed"
181+ "safe borrows of fields of packed structs were was erroneously allowed" ,
182+ @future_incompatible = FutureIncompatibleInfo {
183+ reference: "issue #46043 <https://github.com/rust-lang/rust/issues/46043>" ,
184+ edition: None ,
185+ } ;
165186}
166187
167188declare_lint ! {
168189 pub PATTERNS_IN_FNS_WITHOUT_BODY ,
169190 Warn ,
170- "patterns in functions without body were erroneously allowed"
191+ "patterns in functions without body were erroneously allowed" ,
192+ @future_incompatible = FutureIncompatibleInfo {
193+ reference: "issue #35203 <https://github.com/rust-lang/rust/issues/35203>" ,
194+ edition: None ,
195+ } ;
171196}
172197
173198declare_lint ! {
174199 pub LEGACY_DIRECTORY_OWNERSHIP ,
175200 Deny ,
176201 "non-inline, non-`#[path]` modules (e.g., `mod foo;`) were erroneously allowed in some files \
177- not named `mod.rs`"
202+ not named `mod.rs`",
203+ @future_incompatible = FutureIncompatibleInfo {
204+ reference: "issue #37872 <https://github.com/rust-lang/rust/issues/37872>" ,
205+ edition: None ,
206+ } ;
178207}
179208
180209declare_lint ! {
181210 pub LEGACY_CONSTRUCTOR_VISIBILITY ,
182211 Deny ,
183- "detects use of struct constructors that would be invisible with new visibility rules"
212+ "detects use of struct constructors that would be invisible with new visibility rules" ,
213+ @future_incompatible = FutureIncompatibleInfo {
214+ reference: "issue #39207 <https://github.com/rust-lang/rust/issues/39207>" ,
215+ edition: None ,
216+ } ;
184217}
185218
186219declare_lint ! {
187220 pub MISSING_FRAGMENT_SPECIFIER ,
188221 Deny ,
189- "detects missing fragment specifiers in unused `macro_rules!` patterns"
222+ "detects missing fragment specifiers in unused `macro_rules!` patterns" ,
223+ @future_incompatible = FutureIncompatibleInfo {
224+ reference: "issue #40107 <https://github.com/rust-lang/rust/issues/40107>" ,
225+ edition: None ,
226+ } ;
190227}
191228
192229declare_lint ! {
193230 pub PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES ,
194231 Deny ,
195- "detects parenthesized generic parameters in type and module names"
232+ "detects parenthesized generic parameters in type and module names" ,
233+ @future_incompatible = FutureIncompatibleInfo {
234+ reference: "issue #42238 <https://github.com/rust-lang/rust/issues/42238>" ,
235+ edition: None ,
236+ } ;
196237}
197238
198239declare_lint ! {
199240 pub LATE_BOUND_LIFETIME_ARGUMENTS ,
200241 Warn ,
201- "detects generic lifetime arguments in path segments with late bound lifetime parameters"
242+ "detects generic lifetime arguments in path segments with late bound lifetime parameters" ,
243+ @future_incompatible = FutureIncompatibleInfo {
244+ reference: "issue #42868 <https://github.com/rust-lang/rust/issues/42868>" ,
245+ edition: None ,
246+ } ;
202247}
203248
204249declare_lint ! {
205250 pub ORDER_DEPENDENT_TRAIT_OBJECTS ,
206251 Deny ,
207- "trait-object types were treated as different depending on marker-trait order"
252+ "trait-object types were treated as different depending on marker-trait order" ,
253+ @future_incompatible = FutureIncompatibleInfo {
254+ reference: "issue #56484 <https://github.com/rust-lang/rust/issues/56484>" ,
255+ edition: None ,
256+ } ;
208257}
209258
210259declare_lint ! {
@@ -247,7 +296,11 @@ declare_lint! {
247296declare_lint ! {
248297 pub TYVAR_BEHIND_RAW_POINTER ,
249298 Warn ,
250- "raw pointer to an inference variable"
299+ "raw pointer to an inference variable" ,
300+ @future_incompatible = FutureIncompatibleInfo {
301+ reference: "issue #46906 <https://github.com/rust-lang/rust/issues/46906>" ,
302+ edition: Some ( Edition :: Edition2018 ) ,
303+ } ;
251304}
252305
253306declare_lint ! {
@@ -266,19 +319,33 @@ declare_lint! {
266319 pub ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE ,
267320 Allow ,
268321 "fully qualified paths that start with a module name \
269- instead of `crate`, `self`, or an extern crate name"
322+ instead of `crate`, `self`, or an extern crate name",
323+ @future_incompatible = FutureIncompatibleInfo {
324+ reference: "issue #53130 <https://github.com/rust-lang/rust/issues/53130>" ,
325+ edition: Some ( Edition :: Edition2018 ) ,
326+ } ;
270327}
271328
272329declare_lint ! {
273330 pub ILLEGAL_FLOATING_POINT_LITERAL_PATTERN ,
274331 Warn ,
275- "floating-point literals cannot be used in patterns"
332+ "floating-point literals cannot be used in patterns" ,
333+ @future_incompatible = FutureIncompatibleInfo {
334+ reference: "issue #41620 <https://github.com/rust-lang/rust/issues/41620>" ,
335+ edition: None ,
336+ } ;
276337}
277338
278339declare_lint ! {
279340 pub UNSTABLE_NAME_COLLISIONS ,
280341 Warn ,
281- "detects name collision with an existing but unstable method"
342+ "detects name collision with an existing but unstable method" ,
343+ @future_incompatible = FutureIncompatibleInfo {
344+ reference: "issue #48919 <https://github.com/rust-lang/rust/issues/48919>" ,
345+ edition: None ,
346+ // Note: this item represents future incompatibility of all unstable functions in the
347+ // standard library, and thus should never be removed or changed to an error.
348+ } ;
282349}
283350
284351declare_lint ! {
@@ -296,7 +363,11 @@ declare_lint! {
296363declare_lint ! {
297364 pub DUPLICATE_MACRO_EXPORTS ,
298365 Deny ,
299- "detects duplicate macro exports"
366+ "detects duplicate macro exports" ,
367+ @future_incompatible = FutureIncompatibleInfo {
368+ reference: "issue #35896 <https://github.com/rust-lang/rust/issues/35896>" ,
369+ edition: Some ( Edition :: Edition2018 ) ,
370+ } ;
300371}
301372
302373declare_lint ! {
@@ -320,13 +391,21 @@ declare_lint! {
320391declare_lint ! {
321392 pub WHERE_CLAUSES_OBJECT_SAFETY ,
322393 Warn ,
323- "checks the object safety of where clauses"
394+ "checks the object safety of where clauses" ,
395+ @future_incompatible = FutureIncompatibleInfo {
396+ reference: "issue #51443 <https://github.com/rust-lang/rust/issues/51443>" ,
397+ edition: None ,
398+ } ;
324399}
325400
326401declare_lint ! {
327402 pub PROC_MACRO_DERIVE_RESOLUTION_FALLBACK ,
328403 Warn ,
329- "detects proc macro derives using inaccessible names from parent modules"
404+ "detects proc macro derives using inaccessible names from parent modules" ,
405+ @future_incompatible = FutureIncompatibleInfo {
406+ reference: "issue #50504 <https://github.com/rust-lang/rust/issues/50504>" ,
407+ edition: None ,
408+ } ;
330409}
331410
332411declare_lint ! {
@@ -340,7 +419,11 @@ declare_lint! {
340419 pub MACRO_EXPANDED_MACRO_EXPORTS_ACCESSED_BY_ABSOLUTE_PATHS ,
341420 Deny ,
342421 "macro-expanded `macro_export` macros from the current crate \
343- cannot be referred to by absolute paths"
422+ cannot be referred to by absolute paths",
423+ @future_incompatible = FutureIncompatibleInfo {
424+ reference: "issue #52234 <https://github.com/rust-lang/rust/issues/52234>" ,
425+ edition: None ,
426+ } ;
344427}
345428
346429declare_lint ! {
@@ -353,15 +436,23 @@ declare_lint! {
353436 pub INDIRECT_STRUCTURAL_MATCH ,
354437 // defaulting to allow until rust-lang/rust#62614 is fixed.
355438 Allow ,
356- "pattern with const indirectly referencing non-`#[structural_match]` type"
439+ "pattern with const indirectly referencing non-`#[structural_match]` type" ,
440+ @future_incompatible = FutureIncompatibleInfo {
441+ reference: "issue #62411 <https://github.com/rust-lang/rust/issues/62411>" ,
442+ edition: None ,
443+ } ;
357444}
358445
359446/// Some lints that are buffered from `libsyntax`. See `syntax::early_buffered_lints`.
360447pub mod parser {
361448 declare_lint ! {
362449 pub ILL_FORMED_ATTRIBUTE_INPUT ,
363450 Warn ,
364- "ill-formed attribute inputs that were previously accepted and used in practice"
451+ "ill-formed attribute inputs that were previously accepted and used in practice" ,
452+ @future_incompatible = super :: FutureIncompatibleInfo {
453+ reference: "issue #57571 <https://github.com/rust-lang/rust/issues/57571>" ,
454+ edition: None ,
455+ } ;
365456 }
366457
367458 declare_lint ! {
@@ -387,25 +478,41 @@ declare_lint! {
387478declare_lint ! {
388479 pub AMBIGUOUS_ASSOCIATED_ITEMS ,
389480 Deny ,
390- "ambiguous associated items"
481+ "ambiguous associated items" ,
482+ @future_incompatible = FutureIncompatibleInfo {
483+ reference: "issue #57644 <https://github.com/rust-lang/rust/issues/57644>" ,
484+ edition: None ,
485+ } ;
391486}
392487
393488declare_lint ! {
394489 pub NESTED_IMPL_TRAIT ,
395490 Warn ,
396- "nested occurrence of `impl Trait` type"
491+ "nested occurrence of `impl Trait` type" ,
492+ @future_incompatible = FutureIncompatibleInfo {
493+ reference: "issue #59014 <https://github.com/rust-lang/rust/issues/59014>" ,
494+ edition: None ,
495+ } ;
397496}
398497
399498declare_lint ! {
400499 pub MUTABLE_BORROW_RESERVATION_CONFLICT ,
401500 Warn ,
402- "reservation of a two-phased borrow conflicts with other shared borrows"
501+ "reservation of a two-phased borrow conflicts with other shared borrows" ,
502+ @future_incompatible = FutureIncompatibleInfo {
503+ reference: "issue #59159 <https://github.com/rust-lang/rust/issues/59159>" ,
504+ edition: None ,
505+ } ;
403506}
404507
405508declare_lint ! {
406509 pub SOFT_UNSTABLE ,
407510 Deny ,
408- "a feature gate that doesn't break dependent crates"
511+ "a feature gate that doesn't break dependent crates" ,
512+ @future_incompatible = FutureIncompatibleInfo {
513+ reference: "issue #64266 <https://github.com/rust-lang/rust/issues/64266>" ,
514+ edition: None ,
515+ } ;
409516}
410517
411518declare_lint_pass ! {
0 commit comments