make ///
doc comments compatible with naked functions
This commit is contained in:
parent
3954398882
commit
58bfd98baf
@ -460,6 +460,12 @@ fn check_naked(
|
||||
Target::Fn
|
||||
| Target::Method(MethodKind::Trait { body: true } | MethodKind::Inherent) => {
|
||||
for other_attr in attrs {
|
||||
// this covers "sugared doc comments" of the form `/// ...`
|
||||
// it does not cover `#[doc = "..."]`, which is handled below
|
||||
if other_attr.is_doc_comment() {
|
||||
continue;
|
||||
}
|
||||
|
||||
if !ALLOW_LIST.iter().any(|name| other_attr.has_name(*name)) {
|
||||
self.dcx().emit_err(errors::NakedFunctionIncompatibleAttribute {
|
||||
span: other_attr.span,
|
||||
|
@ -239,6 +239,9 @@ pub extern "C" fn valid_b() {
|
||||
}
|
||||
|
||||
#[doc = "foo bar baz"]
|
||||
/// a doc comment
|
||||
// a normal comment
|
||||
#[doc(alias = "ADocAlias")]
|
||||
#[naked]
|
||||
pub unsafe extern "C" fn compatible_doc_attributes() {
|
||||
asm!("", options(noreturn, raw));
|
||||
|
Loading…
Reference in New Issue
Block a user