@@ -14,7 +14,7 @@ use rustc_middle::lint::LintDiagnosticBuilder;
14
14
use rustc_middle:: lint:: { struct_lint_level, LintLevelMap , LintLevelSets , LintSet , LintSource } ;
15
15
use rustc_middle:: ty:: query:: Providers ;
16
16
use rustc_middle:: ty:: TyCtxt ;
17
- use rustc_session:: lint:: { builtin, Level , Lint } ;
17
+ use rustc_session:: lint:: { builtin, Level , Lint , LintId } ;
18
18
use rustc_session:: parse:: feature_err;
19
19
use rustc_session:: Session ;
20
20
use rustc_span:: symbol:: { sym, Symbol } ;
@@ -80,13 +80,13 @@ impl<'s> LintLevelsBuilder<'s> {
80
80
let level = cmp:: min ( level, self . sets . lint_cap ) ;
81
81
82
82
let lint_flag_val = Symbol :: intern ( lint_name) ;
83
- self . check_gated_lint ( lint_flag_val, DUMMY_SP ) ;
84
83
85
84
let ids = match store. find_lints ( & lint_name) {
86
85
Ok ( ids) => ids,
87
86
Err ( _) => continue , // errors handled in check_lint_name_cmdline above
88
87
} ;
89
88
for id in ids {
89
+ self . check_gated_lint ( id, DUMMY_SP ) ;
90
90
let src = LintSource :: CommandLine ( lint_flag_val) ;
91
91
specs. insert ( id, ( level, src) ) ;
92
92
}
@@ -213,9 +213,9 @@ impl<'s> LintLevelsBuilder<'s> {
213
213
let name = meta_item. path . segments . last ( ) . expect ( "empty lint name" ) . ident . name ;
214
214
match store. check_lint_name ( & name. as_str ( ) , tool_name) {
215
215
CheckLintNameResult :: Ok ( ids) => {
216
- self . check_gated_lint ( name, attr. span ) ;
217
216
let src = LintSource :: Node ( name, li. span ( ) , reason) ;
218
217
for id in ids {
218
+ self . check_gated_lint ( * id, attr. span ) ;
219
219
specs. insert ( * id, ( level, src) ) ;
220
220
}
221
221
}
@@ -386,8 +386,8 @@ impl<'s> LintLevelsBuilder<'s> {
386
386
BuilderPush { prev, changed : prev != self . cur }
387
387
}
388
388
389
- fn check_gated_lint ( & self , name : Symbol , span : Span ) {
390
- if name . as_str ( ) == builtin:: UNSAFE_OP_IN_UNSAFE_FN . name
389
+ fn check_gated_lint ( & self , id : LintId , span : Span ) {
390
+ if id == LintId :: of ( builtin:: UNSAFE_OP_IN_UNSAFE_FN )
391
391
&& !self . sess . features_untracked ( ) . unsafe_block_in_unsafe_fn
392
392
{
393
393
feature_err (
0 commit comments