pub struct AcceptContext<'f, 'sess, S: Stage> {
pub(crate) shared: SharedContext<'f, 'sess, S>,
pub(crate) attr_span: Span,
pub(crate) inner_span: Span,
pub(crate) attr_style: AttrStyle,
pub(crate) parsed_description: ParsedDescription,
pub(crate) template: &'f AttributeTemplate,
pub(crate) attr_path: AttrPath,
}Expand description
Context given to every attribute parser when accepting
Gives AttributeParsers enough information to create errors, for example.
Fields§
§attr_span: SpanThe outer span of the attribute currently being parsed
#[attribute(...)]
^^^^^^^^^^^^^^^^^ outer spanFor attributes in cfg_attr, the outer span and inner spans are equal.
inner_span: SpanThe inner span of the attribute currently being parsed.
#[attribute(...)]
^^^^^^^^^^^^^^ inner spanattr_style: AttrStyleWhether it is an inner or outer attribute.
parsed_description: ParsedDescriptionA description of the thing we are parsing using this attribute parser.
We are not only using these parsers for attributes, but also for macros such as the cfg!() macro.
template: &'f AttributeTemplateThe expected structure of the attribute.
Used in reporting errors to give a hint to users what the attribute should look like.
attr_path: AttrPathThe name of the attribute we’re currently accepting.
Implementations§
Source§impl<S: Stage> AcceptContext<'_, '_, S>
impl<S: Stage> AcceptContext<'_, '_, S>
pub(crate) fn parse_limit_int(&mut self, nv: &NameValueParser) -> Option<Limit>
Source§impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S>
impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S>
pub(crate) fn adcx(&mut self) -> AttributeDiagnosticContext<'_, 'f, 'sess, S>
Methods from Deref<Target = SharedContext<'f, 'sess, S>>§
Methods from Deref<Target = AttributeParser<'sess, S>>§
pub(crate) fn sess(&self) -> &'sess Session
pub(crate) fn features(&self) -> &'sess Features
pub(crate) fn features_option(&self) -> Option<&'sess Features>
pub(crate) fn dcx(&self) -> DiagCtxtHandle<'sess>
Sourcepub fn parse_attribute_list(
&mut self,
attrs: &[Attribute],
target_span: Span,
target: Target,
omit_doc: OmitDoc,
lower_span: impl Copy + Fn(Span) -> Span,
emit_lint: impl FnMut(LintId, MultiSpan, AttributeLintKind),
) -> Vec<Attribute>
pub fn parse_attribute_list( &mut self, attrs: &[Attribute], target_span: Span, target: Target, omit_doc: OmitDoc, lower_span: impl Copy + Fn(Span) -> Span, emit_lint: impl FnMut(LintId, MultiSpan, AttributeLintKind), ) -> Vec<Attribute>
Parse a list of attributes.
target_span is the span of the thing this list of attributes is applied to,
and when omit_doc is set, doc attributes are filtered out.
fn lower_attr_args( &self, args: &AttrArgs, lower_span: impl Fn(Span) -> Span, ) -> AttrArgs
pub fn check_attribute_safety( &mut self, attr_path: &AttrPath, attr_span: Span, attr_safety: Safety, emit_lint: &mut impl FnMut(LintId, MultiSpan, AttributeLintKind), )
pub(crate) fn check_invalid_crate_level_attr_item( &self, attr: &AttrItem, inner_span: Span, )
fn first_line_of_next_item(&self, span: Span) -> Option<Span>
pub(crate) fn check_invalid_where_predicate_attrs<'attr>( &self, attrs: impl IntoIterator<Item = &'attr Attribute>, )
Trait Implementations§
Source§impl<'f, 'sess, S: Stage> Deref for AcceptContext<'f, 'sess, S>
impl<'f, 'sess, S: Stage> Deref for AcceptContext<'f, 'sess, S>
Auto Trait Implementations§
impl<'f, 'sess, S> !DynSend for AcceptContext<'f, 'sess, S>
impl<'f, 'sess, S> !DynSync for AcceptContext<'f, 'sess, S>
impl<'f, 'sess, S> Freeze for AcceptContext<'f, 'sess, S>
impl<'f, 'sess, S> !RefUnwindSafe for AcceptContext<'f, 'sess, S>
impl<'f, 'sess, S> !Send for AcceptContext<'f, 'sess, S>
impl<'f, 'sess, S> !Sync for AcceptContext<'f, 'sess, S>
impl<'f, 'sess, S> Unpin for AcceptContext<'f, 'sess, S>
impl<'f, 'sess, S> UnsafeUnpin for AcceptContext<'f, 'sess, S>
impl<'f, 'sess, S> !UnwindSafe for AcceptContext<'f, 'sess, S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<T> ErasedDestructor for Twhere
T: 'static,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 96 bytes