Port #[rustc_skip_during_method_dispatch] to the new attribute system

This commit is contained in:
Pavel Grigorenko
2025-06-18 22:27:35 +03:00
parent 42245d34d2
commit aa80a2b62c
17 changed files with 246 additions and 41 deletions

View File

@@ -50,8 +50,8 @@ impl<S: Stage> SingleAttributeParser<S> for ColdParser {
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));
if let Err(span) = args.no_args() {
cx.expected_no_args(span);
return None;
}
@@ -67,8 +67,8 @@ pub(crate) struct NakedParser {
impl<S: Stage> AttributeParser<S> for NakedParser {
const ATTRIBUTES: AcceptMapping<Self, S> =
&[(&[sym::naked], template!(Word), |this, cx, args| {
if !args.no_args() {
cx.expected_no_args(args.span().unwrap_or(cx.attr_span));
if let Err(span) = args.no_args() {
cx.expected_no_args(span);
return;
}
@@ -175,10 +175,10 @@ impl<S: Stage> SingleAttributeParser<S> for NoMangleParser {
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));
if let Err(span) = args.no_args() {
cx.expected_no_args(span);
return None;
};
}
Some(AttributeKind::NoMangle(cx.attr_span))
}