rustc_attr_parsing/attributes/loop_match.rs
1use rustc_hir::Target;
2use rustc_hir::attrs::AttributeKind;
3use rustc_span::{Span, Symbol, sym};
4
5use crate::attributes::{NoArgsAttributeParser, OnDuplicate};
6use crate::context::MaybeWarn::Allow;
7use crate::context::{AllowedTargets, Stage};
8pub(crate) struct LoopMatchParser;
9impl<S: Stage> NoArgsAttributeParser<S> for LoopMatchParser {
10 const PATH: &[Symbol] = &[sym::loop_match];
11 const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
12 const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Expression)]);
13 const CREATE: fn(Span) -> AttributeKind = AttributeKind::LoopMatch;
14}
15
16pub(crate) struct ConstContinueParser;
17impl<S: Stage> NoArgsAttributeParser<S> for ConstContinueParser {
18 const PATH: &[Symbol] = &[sym::const_continue];
19 const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
20 const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Expression)]);
21 const CREATE: fn(Span) -> AttributeKind = AttributeKind::ConstContinue;
22}