@@ -27,8 +27,6 @@ use crate::hir::def_id::{CrateNum, LOCAL_CRATE};
27
27
use crate :: hir:: intravisit;
28
28
use crate :: hir;
29
29
use crate :: lint:: builtin:: BuiltinLintDiagnostics ;
30
- use crate :: lint:: builtin:: parser:: { ILL_FORMED_ATTRIBUTE_INPUT , META_VARIABLE_MISUSE } ;
31
- use crate :: lint:: builtin:: parser:: INCOMPLETE_INCLUDE ;
32
30
use crate :: session:: { Session , DiagnosticMessageId } ;
33
31
use crate :: ty:: TyCtxt ;
34
32
use crate :: ty:: query:: Providers ;
@@ -37,8 +35,6 @@ use errors::{DiagnosticBuilder, DiagnosticId};
37
35
use std:: { hash, ptr} ;
38
36
use syntax:: ast;
39
37
use syntax:: source_map:: { MultiSpan , ExpnKind , DesugaringKind } ;
40
- use syntax:: early_buffered_lints:: BufferedEarlyLintId ;
41
- use syntax:: edition:: Edition ;
42
38
use syntax:: symbol:: Symbol ;
43
39
use syntax_pos:: hygiene:: MacroKind ;
44
40
use syntax_pos:: Span ;
@@ -47,87 +43,7 @@ pub use crate::lint::context::{LateContext, EarlyContext, LintContext, LintStore
47
43
check_crate, check_ast_crate, late_lint_mod, CheckLintNameResult ,
48
44
BufferedEarlyLint , } ;
49
45
50
- pub use rustc_session:: lint:: Level ;
51
-
52
- /// Specification of a single lint.
53
- #[ derive( Copy , Clone , Debug ) ]
54
- pub struct Lint {
55
- /// A string identifier for the lint.
56
- ///
57
- /// This identifies the lint in attributes and in command-line arguments.
58
- /// In those contexts it is always lowercase, but this field is compared
59
- /// in a way which is case-insensitive for ASCII characters. This allows
60
- /// `declare_lint!()` invocations to follow the convention of upper-case
61
- /// statics without repeating the name.
62
- ///
63
- /// The name is written with underscores, e.g., "unused_imports".
64
- /// On the command line, underscores become dashes.
65
- pub name : & ' static str ,
66
-
67
- /// Default level for the lint.
68
- pub default_level : Level ,
69
-
70
- /// Description of the lint or the issue it detects.
71
- ///
72
- /// e.g., "imports that are never used"
73
- pub desc : & ' static str ,
74
-
75
- /// Starting at the given edition, default to the given lint level. If this is `None`, then use
76
- /// `default_level`.
77
- pub edition_lint_opts : Option < ( Edition , Level ) > ,
78
-
79
- /// `true` if this lint is reported even inside expansions of external macros.
80
- pub report_in_external_macro : bool ,
81
-
82
- pub future_incompatible : Option < FutureIncompatibleInfo > ,
83
-
84
- pub is_plugin : bool ,
85
- }
86
-
87
- /// Extra information for a future incompatibility lint.
88
- #[ derive( Copy , Clone , Debug ) ]
89
- pub struct FutureIncompatibleInfo {
90
- /// e.g., a URL for an issue/PR/RFC or error code
91
- pub reference : & ' static str ,
92
- /// If this is an edition fixing lint, the edition in which
93
- /// this lint becomes obsolete
94
- pub edition : Option < Edition > ,
95
- }
96
-
97
- impl Lint {
98
- pub const fn default_fields_for_macro ( ) -> Self {
99
- Lint {
100
- name : "" ,
101
- default_level : Level :: Forbid ,
102
- desc : "" ,
103
- edition_lint_opts : None ,
104
- is_plugin : false ,
105
- report_in_external_macro : false ,
106
- future_incompatible : None ,
107
- }
108
- }
109
-
110
- /// Returns the `rust::lint::Lint` for a `syntax::early_buffered_lints::BufferedEarlyLintId`.
111
- pub fn from_parser_lint_id ( lint_id : BufferedEarlyLintId ) -> & ' static Self {
112
- match lint_id {
113
- BufferedEarlyLintId :: IllFormedAttributeInput => ILL_FORMED_ATTRIBUTE_INPUT ,
114
- BufferedEarlyLintId :: MetaVariableMisuse => META_VARIABLE_MISUSE ,
115
- BufferedEarlyLintId :: IncompleteInclude => INCOMPLETE_INCLUDE ,
116
- }
117
- }
118
-
119
- /// Gets the lint's name, with ASCII letters converted to lowercase.
120
- pub fn name_lower ( & self ) -> String {
121
- self . name . to_ascii_lowercase ( )
122
- }
123
-
124
- pub fn default_level ( & self , session : & Session ) -> Level {
125
- self . edition_lint_opts
126
- . filter ( |( e, _) | * e <= session. edition ( ) )
127
- . map ( |( _, l) | l)
128
- . unwrap_or ( self . default_level )
129
- }
130
- }
46
+ pub use rustc_session:: lint:: { Lint , Level , FutureIncompatibleInfo } ;
131
47
132
48
/// Declares a static item of type `&'static Lint`.
133
49
#[ macro_export]
0 commit comments