Skip to main content

FinalizeCheckContext

Struct FinalizeCheckContext 

Source
pub(crate) struct FinalizeCheckContext<'p, 'sess> {
    pub(crate) shared: SharedContext<'p, 'sess>,
    pub(crate) all_attrs: &'p [RefPathParser<'p>],
    pub(crate) parsed_attrs: &'p [Attribute],
}
Expand description

Context given to deferred cross-attribute checks (finalize_check).

These checks run after every attribute on an item has been finalized, so unlike FinalizeContext this context can also inspect the fully parsed attributes via parsed_attrs.

Fields§

§shared: SharedContext<'p, 'sess>§all_attrs: &'p [RefPathParser<'p>]

A list of all attribute on this syntax node.

Useful for compatibility checks with other attributes.

Unlike parsed_attrs, this only contains the paths of the attributes.

§parsed_attrs: &'p [Attribute]

All attributes that have been parsed on this syntax node.

Unlike all_attrs, this contains the fully parsed attributes.

Methods from Deref<Target = SharedContext<'p, 'sess>>§

Source

pub(crate) fn emit_err( &self, diag: impl for<'x> Diagnostic<'x>, ) -> ErrorGuaranteed

Source

pub(crate) fn emit_lint( &mut self, lint: &'static Lint, diagnostic: impl for<'x> Diagnostic<'x, ()> + DynSend + DynSync + 'static, span: impl Into<MultiSpan>, )

Emit a lint. This method is somewhat special, since lints emitted during attribute parsing must be delayed until after HIR is built. This method will take care of the details of that.

Source

pub(crate) fn emit_lint_with_sess<F: for<'a> FnOnce(DiagCtxtHandle<'a>, Level, &Session) -> Diag<'a, ()> + DynSend + DynSync + 'static>( &mut self, lint: &'static Lint, callback: F, span: impl Into<MultiSpan>, )

Source

fn emit_lint_inner( &mut self, lint: &'static Lint, kind: EmitAttribute, span: impl Into<MultiSpan>, )

Source

pub(crate) fn warn_unused_duplicate( &mut self, used_span: Span, unused_span: Span, )

Source

pub(crate) fn warn_unused_duplicate_future_error( &mut self, used_span: Span, unused_span: Span, )

Methods from Deref<Target = AttributeParser<'sess>>§

Source

pub(crate) fn sess(&self) -> &'sess Session

Source

pub(crate) fn features(&self) -> &'sess Features

Source

pub(crate) fn features_option(&self) -> Option<&'sess Features>

Source

pub(crate) fn dcx(&self) -> DiagCtxtHandle<'sess>

Source

pub(crate) fn emit_err( &self, diag: impl for<'x> Diagnostic<'x>, ) -> ErrorGuaranteed

Source

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, EmitAttribute), ) -> 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.

Source

fn check_args_used(&self, attr: &Attribute, args: &ArgParser)

Checks whether all ArgParsers were observed by an attribute parser at least once This check exists because otherwise it is too easy to accidentally ignore the arguments of an attribute

Source

fn lower_attr_args( &self, args: &AttrArgs, lower_span: impl Fn(Span) -> Span, ) -> AttrArgs

Source

pub fn check_attribute_safety( &mut self, attr_path: &AttrPath, attr_span: Span, attr_safety: Safety, expected_safety: AttributeSafety, emit_lint: &mut impl FnMut(LintId, MultiSpan, EmitAttribute), )

Source

pub fn check_attribute_stability( &mut self, attr_path: &AttrPath, attr_span: Span, expected_stability: AttributeStability, )

Source

pub(crate) fn check_invalid_crate_level_attr_item( &self, attr: &AttrItem, inner_span: Span, )

Source

fn first_line_of_next_item(&self, span: Span) -> Option<Span>

Source

pub(crate) fn check_invalid_where_predicate_attrs<'attr>( &self, attrs: impl IntoIterator<Item = &'attr Attribute>, )

Trait Implementations§

Source§

impl<'p, 'sess: 'p> Deref for FinalizeCheckContext<'p, 'sess>

Source§

type Target = SharedContext<'p, 'sess>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'p, 'sess: 'p> DerefMut for FinalizeCheckContext<'p, 'sess>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<'p, 'sess> !DynSend for FinalizeCheckContext<'p, 'sess>

§

impl<'p, 'sess> !DynSync for FinalizeCheckContext<'p, 'sess>

§

impl<'p, 'sess> !Freeze for FinalizeCheckContext<'p, 'sess>

§

impl<'p, 'sess> !RefUnwindSafe for FinalizeCheckContext<'p, 'sess>

§

impl<'p, 'sess> !Send for FinalizeCheckContext<'p, 'sess>

§

impl<'p, 'sess> !Sync for FinalizeCheckContext<'p, 'sess>

§

impl<'p, 'sess> !UnwindSafe for FinalizeCheckContext<'p, 'sess>

§

impl<'p, 'sess> Unpin for FinalizeCheckContext<'p, 'sess>

§

impl<'p, 'sess> UnsafeUnpin for FinalizeCheckContext<'p, 'sess>

Blanket Implementations§

Source§

impl<T> Aligned for T

Source§

const ALIGN: Alignment

Alignment of Self.
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more

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: 72 bytes