@@ -14,7 +14,7 @@ use rustc_middle::lint::LintDiagnosticBuilder;
1414use rustc_middle:: lint:: { struct_lint_level, LintLevelMap , LintLevelSets , LintSet , LintSource } ;
1515use rustc_middle:: ty:: query:: Providers ;
1616use rustc_middle:: ty:: TyCtxt ;
17- use rustc_session:: lint:: { builtin, Level , Lint } ;
17+ use rustc_session:: lint:: { builtin, Level , Lint , LintId } ;
1818use rustc_session:: parse:: feature_err;
1919use rustc_session:: Session ;
2020use rustc_span:: symbol:: { sym, Symbol } ;
@@ -80,13 +80,13 @@ impl<'s> LintLevelsBuilder<'s> {
8080 let level = cmp:: min ( level, self . sets . lint_cap ) ;
8181
8282 let lint_flag_val = Symbol :: intern ( lint_name) ;
83- self . check_gated_lint ( lint_flag_val, DUMMY_SP ) ;
8483
8584 let ids = match store. find_lints ( & lint_name) {
8685 Ok ( ids) => ids,
8786 Err ( _) => continue , // errors handled in check_lint_name_cmdline above
8887 } ;
8988 for id in ids {
89+ self . check_gated_lint ( id, DUMMY_SP ) ;
9090 let src = LintSource :: CommandLine ( lint_flag_val) ;
9191 specs. insert ( id, ( level, src) ) ;
9292 }
@@ -213,9 +213,9 @@ impl<'s> LintLevelsBuilder<'s> {
213213 let name = meta_item. path . segments . last ( ) . expect ( "empty lint name" ) . ident . name ;
214214 match store. check_lint_name ( & name. as_str ( ) , tool_name) {
215215 CheckLintNameResult :: Ok ( ids) => {
216- self . check_gated_lint ( name, attr. span ) ;
217216 let src = LintSource :: Node ( name, li. span ( ) , reason) ;
218217 for id in ids {
218+ self . check_gated_lint ( * id, attr. span ) ;
219219 specs. insert ( * id, ( level, src) ) ;
220220 }
221221 }
@@ -386,8 +386,8 @@ impl<'s> LintLevelsBuilder<'s> {
386386 BuilderPush { prev, changed : prev != self . cur }
387387 }
388388
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 )
391391 && !self . sess . features_untracked ( ) . unsafe_block_in_unsafe_fn
392392 {
393393 feature_err (
0 commit comments