make ///
doc comments compatible with naked functions
This commit is contained in:
parent
3954398882
commit
58bfd98baf
2 changed files with 9 additions and 0 deletions
|
@ -460,6 +460,12 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||||
Target::Fn
|
Target::Fn
|
||||||
| Target::Method(MethodKind::Trait { body: true } | MethodKind::Inherent) => {
|
| Target::Method(MethodKind::Trait { body: true } | MethodKind::Inherent) => {
|
||||||
for other_attr in attrs {
|
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)) {
|
if !ALLOW_LIST.iter().any(|name| other_attr.has_name(*name)) {
|
||||||
self.dcx().emit_err(errors::NakedFunctionIncompatibleAttribute {
|
self.dcx().emit_err(errors::NakedFunctionIncompatibleAttribute {
|
||||||
span: other_attr.span,
|
span: other_attr.span,
|
||||||
|
|
|
@ -239,6 +239,9 @@ pub unsafe extern "C" fn compatible_target_feature() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc = "foo bar baz"]
|
#[doc = "foo bar baz"]
|
||||||
|
/// a doc comment
|
||||||
|
// a normal comment
|
||||||
|
#[doc(alias = "ADocAlias")]
|
||||||
#[naked]
|
#[naked]
|
||||||
pub unsafe extern "C" fn compatible_doc_attributes() {
|
pub unsafe extern "C" fn compatible_doc_attributes() {
|
||||||
asm!("", options(noreturn, raw));
|
asm!("", options(noreturn, raw));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue