Skip to main content

rustc_attr_parsing/attributes/
semantics.rs

1use rustc_feature::AttributeStability;
2
3use super::prelude::*;
4
5pub(crate) struct MayDangleParser;
6impl NoArgsAttributeParser for MayDangleParser {
7    const PATH: &[Symbol] = &[sym::may_dangle];
8    const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(ALL_TARGETS); //FIXME Still checked fully in `check_attr.rs`
9    const STABILITY: AttributeStability = AttributeStability::Unstable {
    gate_name: rustc_span::sym::dropck_eyepatch,
    gate_check: rustc_feature::Features::dropck_eyepatch,
    notes: &[],
}unstable!(dropck_eyepatch);
10    const CREATE: fn(span: Span) -> AttributeKind = AttributeKind::MayDangle;
11}
12
13pub(crate) struct ComptimeParser;
14impl NoArgsAttributeParser for ComptimeParser {
15    const PATH: &[Symbol] = &[sym::rustc_comptime];
16    const ON_DUPLICATE: OnDuplicate = OnDuplicate::Error;
17    const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
18        Allow(Target::Method(MethodKind::Inherent)),
19        Allow(Target::Fn),
20    ]);
21    const STABILITY: AttributeStability = AttributeStability::Unstable {
    gate_name: rustc_span::sym::rustc_attrs,
    gate_check: rustc_feature::Features::rustc_attrs,
    notes: &[],
}unstable!(rustc_attrs);
22    const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcComptime;
23}