fn check_attributes(&mut self, attrs: &[ast::Attribute]) {
        let features = self.cx.ecfg.features.unwrap();
        for attr in attrs.iter() {
            rustc_ast_passes::feature_gate::check_attribute(attr, self.cx.sess, features);
            validate_attr::check_meta(&self.cx.sess.parse_sess, attr);

            // macros are expanded before any lint passes so this warning has to be hardcoded
            if attr.has_name(sym::derive) {
                self.cx
                    .parse_sess()
                    .span_diagnostic
                    .struct_span_warn(attr.span, "`#[derive]` does nothing on macro invocations")
                    .note("this may become a hard error in a future release")
                    .emit();
            }

            if attr.doc_str().is_some() {
                self.cx.sess.parse_sess.buffer_lint_with_diagnostic(
                    &UNUSED_DOC_COMMENTS,
                    attr.span,
                    ast::CRATE_NODE_ID,
                    "unused doc comment",
                    BuiltinLintDiagnostics::UnusedDocComment(attr.span),
                );
            }
        }
    }
// Detect use of feature-gated or invalid attributes on macro invocations
// since they will not be detected after macro expansion.
Detect use of feature-gated or invalid attributes on macro invocations
since they will not be detected after macro expansion.
Detect use of feature - gated or invalid attributes on macro invocations since they will not be detected after macro expansion .
fn check_attributes(&mut self, attrs: &[ast::Attribute]) {
        let features = self.cx.ecfg.features.unwrap();
        for attr in attrs.iter() {
            rustc_ast_passes::feature_gate::check_attribute(attr, self.cx.sess, features);
            validate_attr::check_meta(&self.cx.sess.parse_sess, attr);
            // macros are expanded before any lint passes so this warning has to be hardcoded
            if attr.has_name(sym::derive) {
                self.cx
                    .parse_sess()
                    .span_diagnostic
                    .struct_span_warn(attr.span, "`#[derive]` does nothing on macro invocations")
                    .note("this may become a hard error in a future release")
                    .emit();
            }
            if attr.doc_str().is_some() {
                self.cx.sess.parse_sess.buffer_lint_with_diagnostic(
                    &UNUSED_DOC_COMMENTS,
                    attr.span,
                    ast::CRATE_NODE_ID,
                    "unused doc comment",
                    BuiltinLintDiagnostics::UnusedDocComment(attr.span),
                );
            }
        }
    }
fn check_attributes ( & mut self , attrs : & [ ast :: Attribute ] ) { let features = self . cx . ecfg . features . unwrap ( ) ; for attr in attrs . iter ( ) { rustc_ast_passes :: feature_gate :: check_attribute ( attr , self . cx . sess , features ) ; validate_attr :: check_meta ( & self . cx . sess . parse_sess , attr ) ; // macros are expanded before any lint passes so this warning has to be hardcoded if attr . has_name ( sym :: derive ) { self . cx . parse_sess ( ) . span_diagnostic . struct_span_warn ( attr . span , " " ) . note ( " " ) . emit ( ) ; } if attr . doc_str ( ) . is_some ( ) { self . cx . sess . parse_sess . buffer_lint_with_diagnostic ( & UNUSED_DOC_COMMENTS , attr . span , ast :: CRATE_NODE_ID , " " , BuiltinLintDiagnostics :: UnusedDocComment ( attr . span ) , ) ; } } }
Detect use of feature-gated or invalid attributes on macro invocations
since they will not be detected after macro expansion.
Detect use of feature - gated or invalid attributes on macro invocations since they will not be detected after macro expansion .
&mut self
attrs
&[ast::Attribute]
&mut self
attrs
&[ast::Attribute]