File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
compiler/rustc_passes/src Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -460,6 +460,12 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
460460 Target :: Fn
461461 | Target :: Method ( MethodKind :: Trait { body : true } | MethodKind :: Inherent ) => {
462462 for other_attr in attrs {
463+ // this covers "sugared doc comments" of the form `/// ...`
464+ // it does not cover `#[doc = "..."]`, which is handled below
465+ if other_attr. is_doc_comment ( ) {
466+ continue ;
467+ }
468+
463469 if !ALLOW_LIST . iter ( ) . any ( |name| other_attr. has_name ( * name) ) {
464470 self . dcx ( ) . emit_err ( errors:: NakedFunctionIncompatibleAttribute {
465471 span : other_attr. span ,
Original file line number Diff line number Diff line change @@ -239,6 +239,9 @@ pub unsafe extern "C" fn compatible_target_feature() {
239239}
240240
241241#[ doc = "foo bar baz" ]
242+ /// a doc comment
243+ // a normal comment
244+ #[ doc( alias = "ADocAlias" ) ]
242245#[ naked]
243246pub unsafe extern "C" fn compatible_doc_attributes ( ) {
244247 asm ! ( "" , options( noreturn, raw) ) ;
You can’t perform that action at this time.
0 commit comments