rewrite #[naked] parser
This commit is contained in:
@@ -51,12 +51,29 @@ impl<S: Stage> SingleAttributeParser<S> for ColdParser {
|
||||
if !args.no_args() {
|
||||
cx.expected_no_args(args.span().unwrap_or(cx.attr_span));
|
||||
return None;
|
||||
};
|
||||
}
|
||||
|
||||
Some(AttributeKind::Cold(cx.attr_span))
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) struct NakedParser;
|
||||
|
||||
impl<S: Stage> SingleAttributeParser<S> for NakedParser {
|
||||
const PATH: &[rustc_span::Symbol] = &[sym::naked];
|
||||
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepLast;
|
||||
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
|
||||
const TEMPLATE: AttributeTemplate = template!(Word);
|
||||
|
||||
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option<AttributeKind> {
|
||||
if !args.no_args() {
|
||||
cx.expected_no_args(args.span().unwrap_or(cx.attr_span));
|
||||
return None;
|
||||
}
|
||||
Some(AttributeKind::Naked(cx.attr_span))
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) struct NoMangleParser;
|
||||
|
||||
impl<S: Stage> SingleAttributeParser<S> for NoMangleParser {
|
||||
|
||||
Reference in New Issue
Block a user