Port #[ffi_pure] to the new attribute system

This commit is contained in:
Pavel Grigorenko
2025-06-24 01:10:12 +03:00
parent 99a9fe1b22
commit 5d7771e50d
8 changed files with 27 additions and 9 deletions

View File

@@ -73,3 +73,10 @@ impl<S: Stage> NoArgsAttributeParser<S> for FfiConstParser {
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
const CREATE: fn(Span) -> AttributeKind = AttributeKind::FfiConst;
}
pub(crate) struct FfiPureParser;
impl<S: Stage> NoArgsAttributeParser<S> for FfiPureParser {
const PATH: &[Symbol] = &[sym::ffi_pure];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
const CREATE: fn(Span) -> AttributeKind = AttributeKind::FfiPure;
}

View File

@@ -23,7 +23,7 @@ use crate::attributes::confusables::ConfusablesParser;
use crate::attributes::deprecation::DeprecationParser;
use crate::attributes::inline::{InlineParser, RustcForceInlineParser};
use crate::attributes::link_attrs::{
ExportStableParser, FfiConstParser, LinkNameParser, LinkSectionParser,
ExportStableParser, FfiConstParser, FfiPureParser, LinkNameParser, LinkSectionParser,
};
use crate::attributes::lint_helpers::{AsPtrParser, PassByValueParser, PubTransparentParser};
use crate::attributes::loop_match::{ConstContinueParser, LoopMatchParser};
@@ -149,6 +149,7 @@ attribute_parsers!(
Single<WithoutArgs<ConstStabilityIndirectParser>>,
Single<WithoutArgs<ExportStableParser>>,
Single<WithoutArgs<FfiConstParser>>,
Single<WithoutArgs<FfiPureParser>>,
Single<WithoutArgs<LoopMatchParser>>,
Single<WithoutArgs<MayDangleParser>>,
Single<WithoutArgs<NoImplicitPreludeParser>>,