rustc_attr_parsing/attributes/
body.rs

1//! Attributes that can be found in function body.
2
3use rustc_hir::Target;
4use rustc_hir::attrs::AttributeKind;
5use rustc_span::{Symbol, sym};
6
7use super::{NoArgsAttributeParser, OnDuplicate};
8use crate::context::MaybeWarn::Allow;
9use crate::context::{AllowedTargets, Stage};
10
11pub(crate) struct CoroutineParser;
12
13impl<S: Stage> NoArgsAttributeParser<S> for CoroutineParser {
14    const PATH: &[Symbol] = &[sym::coroutine];
15    const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
16    const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Closure)]);
17    const CREATE: fn(rustc_span::Span) -> AttributeKind = |span| AttributeKind::Coroutine(span);
18}