@@ -11,6 +11,7 @@ use rustc_hir::attrs::AttributeKind;
1111use rustc_hir:: lints:: { AttributeLint , AttributeLintKind } ;
1212use rustc_hir:: { AttrPath , CRATE_HIR_ID , HirId } ;
1313use rustc_session:: Session ;
14+ use rustc_session:: lint:: { Lint , LintId } ;
1415use rustc_span:: { ErrorGuaranteed , Span , Symbol } ;
1516
1617use crate :: AttributeParser ;
@@ -381,19 +382,20 @@ impl<'f, 'sess: 'f, S: Stage> SharedContext<'f, 'sess, S> {
381382 /// Emit a lint. This method is somewhat special, since lints emitted during attribute parsing
382383 /// must be delayed until after HIR is built. This method will take care of the details of
383384 /// that.
384- pub ( crate ) fn emit_lint ( & mut self , lint : AttributeLintKind , span : Span ) {
385+ pub ( crate ) fn emit_lint ( & mut self , lint : & ' static Lint , kind : AttributeLintKind , span : Span ) {
385386 if !matches ! (
386387 self . stage. should_emit( ) ,
387388 ShouldEmit :: ErrorsAndLints | ShouldEmit :: EarlyFatal { also_emit_lints: true }
388389 ) {
389390 return ;
390391 }
391392 let id = self . target_id ;
392- ( self . emit_lint ) ( AttributeLint { id, span, kind : lint } ) ;
393+ ( self . emit_lint ) ( AttributeLint { lint_id : LintId :: of ( lint ) , id, span, kind } ) ;
393394 }
394395
395396 pub ( crate ) fn warn_unused_duplicate ( & mut self , used_span : Span , unused_span : Span ) {
396397 self . emit_lint (
398+ rustc_session:: lint:: builtin:: UNUSED_ATTRIBUTES ,
397399 AttributeLintKind :: UnusedDuplicate {
398400 this : unused_span,
399401 other : used_span,
@@ -409,6 +411,7 @@ impl<'f, 'sess: 'f, S: Stage> SharedContext<'f, 'sess, S> {
409411 unused_span : Span ,
410412 ) {
411413 self . emit_lint (
414+ rustc_session:: lint:: builtin:: UNUSED_ATTRIBUTES ,
412415 AttributeLintKind :: UnusedDuplicate {
413416 this : unused_span,
414417 other : used_span,
@@ -632,9 +635,10 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
632635 }
633636
634637 pub ( crate ) fn warn_empty_attribute ( & mut self , span : Span ) {
635- let attr_path = self . attr_path . clone ( ) ;
638+ let attr_path = self . attr_path . clone ( ) . to_string ( ) ;
636639 let valid_without_list = self . template . word ;
637640 self . emit_lint (
641+ rustc_session:: lint:: builtin:: UNUSED_ATTRIBUTES ,
638642 AttributeLintKind :: EmptyAttribute { first_span : span, attr_path, valid_without_list } ,
639643 span,
640644 ) ;
0 commit comments